chrishawkins Posted August 26, 2007 Share Posted August 26, 2007 Is it possible to pull the cookies of a viewers browser when you are using a php script to track them on your site and return the info to a stats page, just as it would be done using javascript? If it sounds like I don't know what I am talking about, it's because I don't. I am a novice at best. I am running a stats script on my server and using it to track the stats of individuals that view my site page that I have the code snippet on that returns the info back to my stats page. I have done this my embedding the url to the .swf file that pulls that stats in my sites page. Well, it's not an actual .swf file. I have the .htaccess file set like this RewriteEngine on RewriteRule image.swf image.php and inside the image.php file is this <?PHP $lvc_include_dir = 'include/'; include($lvc_include_dir.'new-visitor.inc.php3'); ?> I am wondering if it is possible to retrieve the cookies as well using php scripting... Either the cookies of my site or of another site that are saved to the viewers computer... Please let me know if this is at all possible.. ~Chris Quote Link to comment https://forums.phpfreaks.com/topic/66759-retrieving-cookies-with-php-same-as-in-java/ Share on other sites More sharing options...
Glyde Posted August 26, 2007 Share Posted August 26, 2007 The nature of cookies is that you can only view and access the ones that were created from your site. To create cookies from PHP, you will need the setcookie or header function, and to access them, you can use the $_COOKIE global variable Quote Link to comment https://forums.phpfreaks.com/topic/66759-retrieving-cookies-with-php-same-as-in-java/#findComment-334660 Share on other sites More sharing options...
chrishawkins Posted August 27, 2007 Author Share Posted August 27, 2007 The nature of cookies is that you can only view and access the ones that were created from your site. To create cookies from PHP, you will need the setcookie or header function, and to access them, you can use the $_COOKIE global variable Ok, I guess that what I am really trying to get at here is this... I bought a domain several months back for the sole purpose of housing a statistics script, that does exactly that; it sends back information about the viewers of my various sites. This script itself is rather unconventional, as I have recently found other scripts that show much more information, such as phpMyVisites and Trace Watch, two wonderful open source stats scripts that I would suggest to anyone. However, I continue to use the original script that I had found, but only to capture the viewers IP address, which neither phpMyVisites nor Trace Watch do. So, moving along... The reason I have come to post this today is this; I have recently found that this php stats script that I have (the unconventional one) has proven to be pretty good for tracking the IP's, the ISP's, and the browsers of the people who view my myspace page... Yes yes I know, myspace!! What a joke, but I do have one. What I am trying to accomplish here is to be able to also return the viewers primary myspace photo, a URL to the viewers profile page, or maybe just the users myspace ID and I will handle the rest. But, at this point I would just like to be able to better know who each person is, rather than just having their IP address... I though that this might be done by retrieving the cookies that mayspace generates. Would you happen to have a better suggestion for me? ~Chris Quote Link to comment https://forums.phpfreaks.com/topic/66759-retrieving-cookies-with-php-same-as-in-java/#findComment-335025 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.