Forum Moderators: DixonJones

Message Too Old, No Replies

undersanding HTTP_REFERRER

need a little help here

         

drewst

12:51 pm on Apr 26, 2005 (gmt 0)

10+ Year Member



Right, im currenly writing a logging script in php that will sit for the moment at index.php (the main entry to my site) when the user visits the site via the front door :) browers/version/os/etc... are logged into a database (later to be examined)

next comes the trickier bit, i want to determine how users have got to my site via google, msn, direct link etc.. and log keywords. however i want to not record robots and spiders etc...

How is the HTTP_REFERRER structured? is there a structure

1) to determine search engines im guessing i search for the search engine in the HTTP_REFERRER with string functions

2) to fetermine key words do alot of strink tokenining and extrac thte terms between the +'s (not sure what happens if you type into your browser + and or etc.... between keywords.

3) Major problem HOW do i detect robots etc.. is there a tell tale sign?

Samples of HTTP_REFERRER's would be great to see to i can understand the structure that little bit more.

Is my apporach,having the cide working from index.php ok or does it have any major flaws i have not thought about.

Many thanks

Drew (oh later on in development it will be logging from every page on the sire)

Drew

drewst

1:46 pm on Apr 26, 2005 (gmt 0)

10+ Year Member



or do i detect robots and spiders using user_agent environment variable

Thanks

Drew

leadegroot

6:22 am on Apr 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Drest, the HTTP_REFERRER field value is exactly what you see in the address bar at the top of the browser

Romeo

10:02 am on Apr 27, 2005 (gmt 0)

10+ Year Member



... you probably won't see much, unless you would look at the 'HTTP_REFERER' instead (note the minor unexpected spelling difference) :-)

Perhaps the best source for sample referrer strings is watching the own server's logs.
It is under the visitor's control, however, if he will send a referrer information, or not, or even a faked one.

Regards,
R.