function search_engine_query_string($url = false) {
if(!$url) {
$url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
}
if($url == false) {
return '';
}
$parts = parse_url($url);
parse_str($parts['query'], $query);
$search_engines = array(
'bing' => 'q',
'google' => 'q',
'yahoo' => 'p'
);
preg_match('/(' . implode('|', array_keys($search_engines)) . ')\./', $parts['host'], $matches);
return isset($matches[1]) && isset($query[$search_engines[$matches[1]]]) ? $query[$search_engines[$matches[1]]] : '';
}
?>
$url = "http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=test+hanzala+test%40test.com+worpres&aq=f&aqi=&aql=&oq=";
$url_bing = "http://www.bing.com/search?q=Hanzala+Subhani+h.subhani%40live.com&go=&form=QBRE&filt=all&qs=n&sk=";
$url_yahoo = "http://in.search.yahoo.com/search;_ylt=A8pWB9pHxYlNdhMAUvy7HAx.;_ylc=X1MDMjExNDcyMzAwMwRfcgMyBGFvAzEEZnIDeWZwLXQtNzA0BGhvc3RwdmlkA0JDSzd6M2xsbWs4RkpXc0tUWHRhMVFjSmVEaXhCMDJKeFVjQUFGMlAEbl9ncHMDMARuX3ZwcwMxNgRvcmlnaW4Dc3JwBHF1ZXJ5A2hhbnphbGEgaC5zdWJoYW5pQGxpdmUuY29tBHNhbwMxBHZ0ZXN0aWQDU01FSU4wMQ--?p=hanzala+h.subhani%40live.com&fr2=sb-top&fr=yfp-t-704&rd=r1";
//$url = "http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=test+hanzala+worpres&aq=f&aqi=&aql=&oq=";
$search_url="";
echo "Res=".$search_url = search_engine_query_string($url_yahoo);
echo "
";
preg_match("/[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))/", $search_url, $matches);
echo $matches[0];
?>
if(!$url) {
$url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false;
}
if($url == false) {
return '';
}
$parts = parse_url($url);
parse_str($parts['query'], $query);
$search_engines = array(
'bing' => 'q',
'google' => 'q',
'yahoo' => 'p'
);
preg_match('/(' . implode('|', array_keys($search_engines)) . ')\./', $parts['host'], $matches);
return isset($matches[1]) && isset($query[$search_engines[$matches[1]]]) ? $query[$search_engines[$matches[1]]] : '';
}
?>
$url = "http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=test+hanzala+test%40test.com+worpres&aq=f&aqi=&aql=&oq=";
$url_bing = "http://www.bing.com/search?q=Hanzala+Subhani+h.subhani%40live.com&go=&form=QBRE&filt=all&qs=n&sk=";
$url_yahoo = "http://in.search.yahoo.com/search;_ylt=A8pWB9pHxYlNdhMAUvy7HAx.;_ylc=X1MDMjExNDcyMzAwMwRfcgMyBGFvAzEEZnIDeWZwLXQtNzA0BGhvc3RwdmlkA0JDSzd6M2xsbWs4RkpXc0tUWHRhMVFjSmVEaXhCMDJKeFVjQUFGMlAEbl9ncHMDMARuX3ZwcwMxNgRvcmlnaW4Dc3JwBHF1ZXJ5A2hhbnphbGEgaC5zdWJoYW5pQGxpdmUuY29tBHNhbwMxBHZ0ZXN0aWQDU01FSU4wMQ--?p=hanzala+h.subhani%40live.com&fr2=sb-top&fr=yfp-t-704&rd=r1";
//$url = "http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=test+hanzala+worpres&aq=f&aqi=&aql=&oq=";
$search_url="";
echo "Res=".$search_url = search_engine_query_string($url_yahoo);
echo "
";
preg_match("/[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))/", $search_url, $matches);
echo $matches[0];
?>
No comments:
Post a Comment