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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.