Question

I guys.

Have worked around with cookies in PHP for some time. However something came to my mind.

Does its possible to gather all cookies (without knowing its names), or at least list all cookies names present in a browser?

Regards.

Was it helpful?

Solution

print_r($_COOKIE)

OTHER TIPS

No, you can't. php can only locate cookies created from it self host. This security is from browser side.

Yes, you can get all the cookies that you have set by:

foreach($_COOKIE as $key => $value)
{
  echo $key . " => " . $value;
}

Hope this helps!

No, cookies are domain specific. You could get more protection against cookie hijacking by configuring your cookies as HttpOnly, supported in PHP since 5.2.0.

Not from server side but a great tool for showing all cookies from the client side is MAXA Cookie Manager:. It shows advanced and browser independent cookies, too.

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