Click to See Complete Forum and Search --> : Pulling data from another website
paytrex
08-04-2008, 09:32 PM
ok, here is what I want to do. I am looking for some form of code that I can insert on multiple webpages that will track the ip's of people who visit the website (say webdeveloper.com put the code on their site). The persons ip would then be sent to a script on my site and would be stored on my database. I really have no idea where to start on this or even what to google to learn how to do it. Any help would be great!
Thanks,
Daniel
scragar
08-04-2008, 09:40 PM
http://www.hotscripts.com/Detailed/67038.html
just download, extract(needs Rar, if you don't have it say and I'll repack it as a zip or something), and use, get people to include the visitor_tracking.php code in any way (loading it as an image or javascript are common). You'll need a DB and stuff for it though, edit the visitor_connections.php page for more info.
Sheldon
08-04-2008, 09:41 PM
So.. You want to run a script of external sites that will connect to your server each time it loads?
You could do this via PHP's cURL.
EDIT: Scragar, you beat me to it. :)
paytrex
08-04-2008, 10:00 PM
Thanks scragar. How would I load it as an image in using javascript? Sorry I'm ok in php but this whole concept is new to me.
paytrex
08-04-2008, 10:03 PM
Thanks scragar. How would I load it as an image in using javascript? Sorry I'm ok in php but this whole concept is new to me.
scragar
08-04-2008, 10:12 PM
you need the site you want to monitor to include it, there's samples of the way it works all over the internet, it normaly looks like this:
<script type='text/javascript' src="your domain/the code"></script>
<noscript><img src="your domain/different code, but this code is only different in that it also includes a 1x1px image of a transparant background"></noscript>
^^^^ above code is not very nice, but it works, which is most important.
paytrex
08-04-2008, 10:16 PM
Awesome, Thank you so much!
Znupi
08-05-2008, 05:12 AM
Why would you use the <script> tag at all? It's complicated to have both <script> and <img>s, and useless, from my point of view. You can simply use an image, since there are very few if not no browsers that will load a script and not load an image.
<img src="http://yoursite.com/trackback.php">
// trackback.php
// Log user's IP etc etc...
$img = imageCreate(1, 1); // create an image
imageColorAllocate($img, 255, 255, 255); // since the image is a palette one and not true color, this will make it white.
header("Content-Type: image/gif"); // let the browser know we're sending it a GIF image
imageGif($img); // Output the image as GIF
imageDestroy($img); // Free memory
// Done!
Good luck :)
scragar
08-05-2008, 05:17 AM
Why would you use the <script> tag at all? It's complicated to have both <script> and <img>s, and useless, from my point of view. You can simply use an image, since there are very few if not no browsers that will load a script and not load an image.
<img src="http://yoursite.com/trackback.php">
// trackback.php
// Log user's IP etc etc...
$img = imageCreate(1, 1); // create an image
imageFill($img, 1, 1, imageColorAllocate($img, 255, 255, 255)); // make it white
header("Content-Type: image/gif"); // let the browser know we're sending it a GIF image
imageGif($img); // Output the image as GIF
imageDestroy($img); // Free memory
// Done!
Good luck :)
save and include the image each time, it's far more efficient(or if you fear someone has access to edit the image in some way use file_get_contents (http://php.net/file_get_contents) and just echo the result(your unlikly to run into output problems with such a small image anyway))
paytrex
08-05-2008, 12:46 PM
What if I did have an image that that I wanted to use? How would I code it so that it displayed like my logo image and just place it at the bottom of each page?
Znupi
08-05-2008, 02:11 PM
// trackback.php
// Log user's IP etc etc...
// Send appropriate headers
header("Content-Type: image/jpg");
// Send the actual image / logo
readfile("/path/to/logo.jpg");
// Done!
Why not just track them with sessions?
If the visitor is computer savvy, then they will have all dodgy image URL's taken care of, thats what I do.
My privacy is for me and I for one do not appreciate being tracked. If this is hidden in the site, so be it, why should I put up with my browser requesting what potentially could be a code exploit?
These are the very questions you should ask yourself before you decide on attempting these things... What would you put up with. You don't like people standing over your shoulder watching what you do, do you?!?