Jump to content

Tracking when an external domain uses an image from your server


ilovephp01

Recommended Posts

I want to let other sites use my images. (http://example.com/sample.jpg) but keep track of each time they use the image. So I write track.php to save the request into a DB, then return the image requested from a URL parameter (http://example.com/track.php?returnimage=sample.php) Now any of these external sites can use my image in their HTML <img src="http://example.com/track.php?returnimage=sample.jpg"> and I get my tracking. Works great.

 

Now I want to also keep track of which URL or domain has requested an image. I thought I could use $_SERVER['HTTP_REFERER'] in track.php to see what URL it is coming from, although no luck. It doesn't look like any of the server/environment variables will return domain info I am looking for from this external site. I would like to hold off on adding an addition parameter to the request (http://example.com/track.php?returnimage=sample.jpg&externalsite=example.com) so that I can use the same code for multiple sites.

 

Any ideas/possible?

 

I really appreciate any help. Thank you very much! -Dustin

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.