# Cookike problem

**URL:** <https://forum.kirupa.com/t/cookike-problem/64910>\
**Category:** Uncategorized\
**Created:** [September 21, 2004, 9:12am UTC](https://forum.kirupa.com/t/cookike-problem/64910 "2004-09-21T09:12:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![narko](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@narko](https://forum.kirupa.com/u/narko)\
**Post date:** [September 21, 2004, 9:12am UTC](https://forum.kirupa.com/t/cookike-problem/64910/1 "2004-09-21T09:12:20Z")

</div>

I’m faced with the cookie problem.  
we’re using setcookie() on the domain [www.example.com](http://www.example.com)  
but in fact I need to setup cookies for [example.com](http://example.com) domain.  
so, I use the following syntax (due to php manual):  
setcookie(‘surferid’, 10, 0, ‘/’, ‘.example.com’);  
This way we hope to set cookies for all [example.com](http://example.com) subdomains.  
But anyway I can’t read cookie.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 22, 2004, 4:34am UTC](https://forum.kirupa.com/t/cookike-problem/64910/2 "2004-09-22T04:34:36Z")

</div>

setcookie(‘surferid’, ‘10’, time()+0,’/’,‘[host.com](http://host.com)’);

than u will need a refresh of page inorder to be able to do this

```php

echo $_COOKIE['surferid'];

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 22, 2004, 8:20pm UTC](https://forum.kirupa.com/t/cookike-problem/64910/3 "2004-09-22T20:20:57Z")

</div>

and make sure that cookie is being set in the header of the document!
