PHP $_COOKIE help

Hello! I just figured out was wrong with the Yandex API…apparently it was pushing the email address as a cookie so I wouldn’t need to use JavaScript to get the token and push that through the Yandex API.

Now there’s a new issue–when I use $_COOKIE[“yandex_login”] (the cookie that the API sends to the site which contains the email), it won’t work. The code below is supposed to check if the email address contains my domain. It should be reporting “Word Found”.

<?php
$word = “mail.(my domain)”;
$mystring = $_COOKIE[“yandex_login”];
if(strpos($mystring, $word) !== false){
echo “Word Found!”;
} else{
echo “Word Not Found!”;
}
?>

The cookie seems to be pushed from domain .yandex.com and the path /

How can I get the value of the cookie if $_COOKIE isn’t working? Is there a problem with my code?

You can use var_dump($_COOKIE) to print out all the cookies available; it might be the key is different to what you expect.

Sponsor our Newsletter | Privacy Policy | Terms of Service