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) > <?php $url = "http://www.google.com/search?q=php&ie=utf-8&oe=utf-8&aq=t&rls=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