$ENV{'HTTP_REFERER'} should get it if the header is present. It may not be, depending on the browser and how it acquired the url.
| [reply] [d/l] |
Before you start relying on the Referer header you probably want to look at the section on Security Considerations in the HTTP Specification: many firewall and proxy vendors have taken this on board and you will often find the Referer header removed or obliterated in the request. This is particularly common with popular "desktop firewall" and "internet privacy" software.
/J\
| [reply] |
There are also some browsers which have an option to supress the referrer. (It used to be that they were way too liberal with information given -- the early versions of Netscape used to send your e-mail address with every request, and the referer header with whatever the last page you were on, even if it you weren't following a link.)
You might want to try a different browser, and see if you continue to have the same problem. Oh -- and the correct spelling is the misspelled one -- %ENV{'HTTP_REFERER'}. You can check all of the variables that you have to work with something like: warn map { sprintf "%20s : %s\n", $_, $ENV{$_} } sort keys %ENV;(will send to your webserver's error log, unless you've changed where STDOUT STDERR goes)
Update: STDOUT != STDERR. (shouldn't post before I've had my morning caffeine.. thanks manav for the catch)
| [reply] [d/l] [select] |
Not STDOUT but STDERR....
Manav
| [reply] |
Thanks. I located the problem. The issue was with the site being in frames, and the code to grab the info, was in a framed page, thus I was getting the site as a refered since the main frame page was calling the sub html/cgi. Putting a SSI call to a cgi script to get the info works fine.
Any chance someone knows how i can set a new var to the browser so that all page calls will have the info, without using a dummy form?
| [reply] |
If you just want to see where visitors come from, use a log-file analyser like awstats, wwwstat, analog, webdruid or webalizer. (There are much more).
It would be nice to see on what os you are, to see what fits your needs best. | [reply] |