getting the search words from a google query
am 18.08.2009 17:53:41 von f2008059
hey,
i am a beginner at php and i need your help.
i have a list of urls visited on a particular day in mysql database.
using php i find out all the websites that have a google search.
now i need to strip apart the google query from the entire url.
i think parse function is used for it but i am not sure how it is used etc.
if possible plz send me a small snippet as an example.
cheers.
-------------------------------------------------
Bits-Pilani Goa Campus (http://www.bits-goa.ac.in)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: getting the search words from a google query
am 18.08.2009 17:54:59 von Ashley Sheridan
On Tue, 2009-08-18 at 21:23 +0530, MURTUZA KUTUB Ã wrote:
> hey,
>=20
> i am a beginner at php and i need your help.
>=20
> i have a list of urls visited on a particular day in mysql database.
> using php i find out all the websites that have a google search.
> now i need to strip apart the google query from the entire url.
> i think parse function is used for it but i am not sure how it is used et=
c.
>=20
> if possible plz send me a small snippet as an example.
>=20
> cheers.
>=20
> -------------------------------------------------
> Bits-Pilani Goa Campus (http://www.bits-goa.ac.in)
>=20
>=20
Have you looked at the URL strings themselves? You can see that with a
Google query, the search words appear as part of the q=3D part of the
string.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: getting the search words from a google query
am 19.08.2009 17:07:17 von Shawn McKenzie
MURTUZA KUTUB wrote:
> hey,
>
> i am a beginner at php and i need your help.
>
> i have a list of urls visited on a particular day in mysql database.
> using php i find out all the websites that have a google search.
> now i need to strip apart the google query from the entire url.
> i think parse function is used for it but i am not sure how it is used etc.
>
> if possible plz send me a small snippet as an example.
>
> cheers.
>
> -------------------------------------------------
> Bits-Pilani Goa Campus (http://www.bits-goa.ac.in)
>
$url =
"http://www.google.com/search?q=php&ie=utf-8&oe=utf-8&aq=t&r ls=com.ubuntu:en-US:unofficial&client=firefox-a";
$url_parts = parse_url($url);
print_r($url_parts);
parse_str($url_parts['query'], $query_vars);
print_r($query_vars);
?>
Array
(
[scheme] => http
[host] => www.google.com
[path] => /search
[query] =>
q=php&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial &client=firefox-a
)
Array
(
[q] => php
[ie] => utf-8
[oe] => utf-8
[aq] => t
[rls] => com.ubuntu:en-US:unofficial
[client] => firefox-a
)
Normally for Google the 'q' var is the search term, in this case 'php'.
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php