|
|
Question : getting referring page
|
|
This isn't REALLY a Perl question. More of a 'script-calling' question. I wrote a perl script that gets the $ENV{'HTTP_REFERER'} of the referring page and writes it to a database. It's to keep track of where my visitors are coming from. It works fine and dandy as I have written it. Now the problem is that I'm not sure how to call my script from my web page. I tried to put it in a cheezie tag like so: .
The problem is that the script uses the page (my page) that the tag is on as the referer and not the page that the user came from in the first place.
To clarify: Let's say my page is http://mysite.com/mypage.html and the user comes from http://xyzsite.com/theirpage.html. The referer variable in my script that I call from mypage.html should contain the string 'http://xyzsite.com/theirpage.html'. How can I call my script from mypage.html so that it tricks my script into considering xyzsite.com's page as the referring page??
|
Answer : getting referring page
|
|
You can't do that directly. I'd suggest making mypage.html a dynamic page (CGI, etc.). You can then set a cookie (or dynamically add a CGI script parameter) equal to the referring site. Your script can then reference the cookie or CGI parameter instead of HTTP_REFERRER.
|
|
|
|