JoshG
JoshG

Reputation: 131

PHP cURL is not capturing all ASP.NET Cookies

Trying to automate login to a ASP.NET site using PHP & cURL but running into a cookie problem.

When I check in the browser, initial login page stores 5 cookies. Which are ASP.NET_SessionId, __utma, __utmb, __utmc & __utmz

When this page is accessed via cURL the cookie file is storing only one cookie: "ASP.NET_SessionId"

I referred to many posts & tried all kinds of cURL option combinations returning the same result.

I don't know how ASP.NET cookies work or differ from PHP. Any help is appreciated.

Here is my php code:

$cookie_file_path = "tmp/cookie.txt";
$LOGINURL         = "https://godaddy.com"; 
$agent            = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1";

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_HEADER,  1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);         
curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); 
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 
curl_setopt($ch, CURLOPT_URL, $LOGINURL);
$content = curl_exec($ch); 
curl_close($ch);

echo '<textarea style="width:1000px; height:300px">'.$content.'</textarea>';

Upvotes: 0

Views: 890

Answers (1)

Jeppe
Jeppe

Reputation: 2233

__utma, __utmb, __utmc & __utmz are all Google Analytics cookies stored by javascript, thus being created client side.

So no way of processing them through cURL / PHP

Upvotes: 1

Related Questions