Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Thanked 0 Times in 0 Posts

    Retrieving cookies with php same as in java

    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

    $lvc_include_dir = 'include/';
    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...

    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?


  2. #2
    Supreme Master coder!
    Join Date
    Jun 2003
    Cottage Grove, Minnesota
    Thanked 1,159 Times in 1,150 Posts
    You can't read other owners' cookies, only your own.

    I should add ... short of creating a malicious spyware program.

    I'm not a myspace expert, so I don't know if it's possible to run a
    Javascript on myspace. I know you can't run a PHP script. But
    with a Javascript, you can trigger a remote PHP script that can log
    the users info (such as IP) ... that Javascript can be a 1 X 1 pixel
    transparent .gif image (an invisible image) on a particular page.

    Here's an example of what I mean:

    The code on the page itself (taken from an example I found) ...

    <script language="javascript">
    var refz = escape(document.referrer)+"";
    st="<img src='";
    en="' border=0 alt=''></a>";

    The PHP script then logs information and displays the
    .gif image as it's output. It's a way to execute a PHP script
    without using PHP on the website.

    or ... you can do it this way and use PHP to generate the Javascript output. PHP would contain the document.write Javascript stuff.

    <script type="text/javascript" src="http://www.mysite.php/phpscript.php"></script>

    Last edited by mlseim; 08-27-2007 at 03:55 PM.

  3. #3
    New to the CF scene
    Join Date
    Aug 2007
    Thanked 0 Times in 0 Posts
    This is what the code snippet I have on my myspace page looks like now.
    <object type="application/x-shockwave-flash" allowScriptAccess="never" allowNetworking="internal" height="0" width="0" data="http://mydomain/myphpscript.swf">
      <param name="allowScriptAccess" value="never" />
      <param name="allowNetworking" value="internal" />
      <param name="movie" value="http://mydomain/myphpscript.swf" />
      <param name="wmode" value="" />
      <param name="quality" value="high" />
      <param name="menu" value="false" />
    And this seems to be working quite well actually... But, it is only picking up the Browser, IP address, and the ISP of the person viewing my page, along with the URL in which they were viewing when tracked. However, what I am trying to accomplish here is to be able to at least capture the viewers myspace ID. I am disguised my stats collector as a .swf by .htaccess rewrite. I don't know ANYTHING about javascript. I wouldn't know the first place to start. Do you think that you might be willing to lend me a helping hand? I'll show you what I'm working with here so that you can better understand what's going on behind the scenes.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts