0

If I load in a cookie, I am able to get to the page that requires cookies, like this:

$cookie = ".ASPXAUTH=Secret";
curl_setopt($ch, CURLOPT_COOKIE, $cookie);

No problem here, I can run curl_exec, and see the page that requires cookies.

If I also want to send some post data, I can do like this:

$data = array(
     'index' => "Some data is here"
);

$cookie = ".ASPXAUTH=Secret";

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);

I have set up a dump script on my local server, to see if it is working. If i send only the cookie, I can see it in the http headers, and if I send only the post data, I can see the post data.

When I send both, I see only the cookie.

Why?

3
  • ummm what does the script look like that you are sending these curl requests to? Commented May 16, 2011 at 15:08
  • @Neal I'm currently only posting to a dump script on a local server. The script is found here pastebin.com/37mDNNHr Commented May 16, 2011 at 15:11
  • What's the contents of php://input? Maybe the HTTP contents aren't being parsed into the $_POST variable properly depending on how curl sends the Content-Type. Commented May 16, 2011 at 15:37

1 Answer 1

1

I finally found a solution.

If I manually set the cookie, using a custom http_header, I am able to get the results wanted.

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Cookie:.ASPXAUTH=secretData"));

Even tried on different servers - same results.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.