Re: Parsing search strings from referer urls?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux