I'd like to store the keyword that customers use to visit my website in a PHP Session.
Can someone explain how this is done?
So if a customer types 'football laces' and clicks on my site in the list of results, my script would store this data in a session.
Is it universal or would it change depen开发者_JAVA百科ding on Google/Bing/Yahoo search engine.
UPDATE This looks good for me: http://www.liamdelahunty.com/tips/php_google_referer.php Thanks for the input with the answers. Much appreciated.
Many thanks
You could use $_SERVER['HTTP_REFERER']
to see where a user came from. Google does for example put the keywords in the URL.
Strarted to write an answer and then found this :)... Take a look:
http://www.vonfelten.com/blog/2007/06/05/referral-url-from-session-using-php/
And what you get is the url the came from which would include the keyword in question. You could then create functions to extract the keyword from Google, Bing etc URL's
Try this Server and execution environment information
精彩评论