...

View Full Version : Referral URL not getting set



BHL
01-31-2003, 04:41 AM
Hello all--

I am building a script that is going to track information on how the user got to my site. One of the most important pieces of information that I need to capture is the referral URL. From what I have read, the _SERVER[HTTP_REFERER] is supposed to be what I am looking for but it is always empty. Does anyone have any ideas on why? Any insight would be appreciated. Thanks

Spookster
01-31-2003, 04:51 AM
Assuming you spelled it correctly in your actual coding it would be :

_SERVER[HTTP_REFERRER] vs. _SERVER[HTTP_REFERER]

Secondly I wouldn't rely on it. The referrer information is coming from the users web browser. It will only come if they click on a link. If its a bookmark, or they type in the address, or select it from the dropdown history then referrer will be blank. On top of that not all browsers actually send the referrer information or even send it correctly. And some browsers allow people to change that information.

redstormaudio
01-31-2003, 06:09 AM
Originally posted by Spookster
Assuming you spelled it correctly in your actual coding it would be :

_SERVER[HTTP_REFERRER] vs. _SERVER[HTTP_REFERER]

That's assuming there wasn't a typo in the php engine ;)

http://www.php.net/manual/en/reserved.variables.php

You can reference it via $_SERVER['HTTP_REFERER']

Spookster
01-31-2003, 10:28 AM
Originally posted by redstormaudio
That's assuming there wasn't a typo in the php engine ;)



Oh my gosh. lol. I hadn't even noticed that before. :eek:

Íkii
01-31-2003, 11:42 AM
As far as I understand, the sending of "HTTP_REFERER" in the request headers is a browser and ISP/proxy thing. Some do, some don't.

That's why most .hta (mod_rewrite and the like) normally have a condition that sniffs for an empty referer string
{HTTP_+REFERER} !^$ (referer not empty)

brothercake
01-31-2003, 12:08 PM
... it's REFERER because most languages are in American, not English (hence "color=red" etc) ...

redstormaudio
01-31-2003, 12:39 PM
English or American, it's still a typo (http://dictionary.reference.com/search?q=referer).

BHL
01-31-2003, 03:04 PM
Ok, if this is an unreliable way to get this peice of information, does anyone know of a better way?

mordred
01-31-2003, 03:19 PM
You won't find anything better than that...

brothercake
01-31-2003, 03:58 PM
What you could do is set a cookie or session identifier on page A, and verify it on page B

BHL
01-31-2003, 04:00 PM
I am more interested in the information coming from the search engines. The query string with the search terms and the actual search engine the user used to find the site is what I need.

Íkii
01-31-2003, 05:53 PM
As mentioned, you can only use the request headers that are sent to access your page. If certain browseing setups are not sending the headers you want, you cannot make the information appear. Just like you cannot sniff Opera through $_SERVER['USER_AGENT'] if someone is spoofing mozilla.

brothercake
01-31-2003, 06:44 PM
<slightly_off_topic>


Originally posted by Íkii
Just like you cannot sniff Opera through $_SERVER['USER_AGENT'] if someone is spoofing mozilla.

yes you can .. even in spoof modes, the word "Opera" always appears in its UA string ...

</slightly_off_topic>

Íkii
01-31-2003, 09:49 PM
does it, blimey :rolleyes: not very good spoofing that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum