function text_between($start,$end,$string) {
if ($start != '') {$temp = explode($start,$string,2);} else {$temp = array('',$string);}
$temp = explode($end,$temp[1],2);
return $temp[0];
}
function gsscrape($keyword) {
$keyword=str_replace(" ","+",$keyword);
global $kw;
$data=file_get_contents('http://clients1.google.com/complete/search?hl=en&gl=uk&q='.$keyword);
$data=explode('[',$data,3);
$data=explode('],[',$data[2]);
foreach($data as $temp) {
$kw[]= text_between('"','"',$temp);
}
}
#simple to use, just use yourscriptname.php?keywords
if ($_SERVER['QUERY_STRING']!='') {
gsscrape($_SERVER['QUERY_STRING']);
foreach ($kw as $keyword) {
gsscrape($keyword);
}
}
#all results are in array $kw...
print_r($kw);
พอดีเจอโค้ดนี้ เป้น google suggest ผลออกมาเป็น
Array (
- => hotmail [1] => hotmail.fr [2] => hotmail news [3] => hotmail.se [4] => hotmail down [5] => hotmail.com.br
อยากให้ออกมาเป็น
hotmail
hotmail.fr
hotmail news
hotmail.se
hotmail down
hotmail.com.br
ต้องทำยังไงเหรอครับ พอดีไม่มีความรู้เรื่องนี้เลยครับ
ขอบคุณครับ