Question

I am trying to parse the response header cookies for a GET request.

For some reason, getCookies() is empty! I get a 200 Response but for some reason cannot access the cookies. I'm able to get the headers, though.

Is it possible this website is hiding its cookies? What are some ways to retrieve hidden cookies?

$request = new HTTP_Request2($url, HTTP_Request2::METHOD_GET);
$request2 = new HTTP_Request2($newUrl, HTTP_Request2::METHOD_POST);

$response = $request->send();

foreach ($response->getCookies() as $c)
{
   request2->addCookies($c['name'], $c['value']);
}

Cookies are being set with Javascript via (I peeked into their JS code)

<script language="JavaScript">
document.cookie="MRHCId="+Math.round((new Date()).getTime()/1000)+"_0_3600; path=/"; 
</script>

How can I send this cookie along with my PHP Post request?

Was it helpful?

Solution

Posting my comment as an answer in case you want to close the question:

Is it possible that the website doesn't use cookies? They are not required for a website to operate or anything. Or perhaps, it just doesn't set them through the headers? They can be set through javascript. And I wouldn't be surprised with all the JS heavy websites out there. Also, there is no such thing as a "Hidden Cookie".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top