tags:

views:

34

answers:

3

I have a PHP file that generates a JS file, that is being included on a number of sites. I'd like to be able to check which site the file is being included from on each request. I tried using $_SERVER['HTTP_REFERER'] in PHP, but that just returns the domain that the JS file is hosted on.

Any ideas would be greatly appreciated.

+1  A: 

What about 'REQUEST_URI' instead?

lod3n
That seems to provide a link to the actual javascript file's location. :( I'm looking for the page that is including the file. Thanks for the suggestion, though!
Chris Thomson
+1  A: 

It turns out I was actually going the long way around... I was trying to grab the entire URL of the page including it, and then stripping everything but the hostname. $_SERVER['HTTP_HOST'] did exactly what I needed. :)

Chris Thomson
A: 

Check your server logs.

grep access_log insert-your-filename-here.js
pwfisher