Skip to content

Instantly share code, notes, and snippets.

@davidkryzaniak
Last active December 13, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidkryzaniak/4969644 to your computer and use it in GitHub Desktop.
Save davidkryzaniak/4969644 to your computer and use it in GitHub Desktop.
Test to see if Googlebot can set and get cookies
<?php
$expire=time()+1468800;//14days
$cookieName='CookieMonster';
$cookieData='Chocolate Chip';
if(isset($_COOKIE[$cookieName])){
echo "Yep, cookie found!";
}else{
echo "No cookie here! Let me bake one up for you...";
setcookie($cookieName,$cookieData,$expire);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment