zAx Nasr
zAx Nasr

Reputation:

Can I get document.cookie without using javascript? Alternate in PHP

I was doing something but I can't use JavaScript in it.

I want to get the cookies but without using javascript.

But I want to get the same output as of document.cookie.

Upvotes: 1

Views: 3739

Answers (2)

perrohunter
perrohunter

Reputation: 3526

You can't get the same input as in document.cookie, but you can access directly them from $_COOKIE just like macaco said

if you need to set cookie you can do this by using the setcookie() method from php

http://www.php.net/setcookie

cheers

Upvotes: 1

Gerardo
Gerardo

Reputation: 1948

Use $_COOKIE['cookie_name'] in PHP.

$_COOKIE is an array containing all cookies.

Upvotes: 9

Related Questions