Re: Parsing search strings from referer urls?

From: Date: Wed, 26 Jan 2005 22:54:38 +0000
Subject: Re: Parsing search strings from referer urls?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-207439@lists.php.net to get a copy of this message
On Thursday 27 January 2005 04:16, T.J. Mahaffey wrote: > First time post, please be gentle. > > I'd like to be able to extract search strings from referer urls that come > from search engines. (via php, of course) For example, > > http://www.google.com/search?q=foo+bar&ie=UTF-8&oe=UTF-8 > > Now, I realize one might employ grep to pull out this information and its > easy for a human to examine a url like the one above, but I'd like to > programmatically present a nice, tidy list of search words used to generate > the url. > > My gut says that one would need to write a function for each major search > engine to parse out this information since each engine is unique in how it > builds the url. However, I thought after poring over the manual and online > docs/list and not finding a solution, and before I went off and reinvented > the wheel, I would float the question and see what you fine folks have to > say about the subject. My gut says that you haven't been looking too closely at the manual. There's a chapter on "URL Functions", sounds promising, inside it mentions a function called parse_url(), very useful, the description for that function shows a link to parse_str(), bingo, you got all you need. Of course you still have to examine the extracted data to determine which search engine it came from and proceed accordingly. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ New Year Resolution: Ignore top posted posts

« previous php.general (#207439) next »