Baidu Search effect (the page came from the data address, by the server to obtain):
<! DOCTYPE html>PHP Code:<?phpheader ("access-control-allow-origin:*");//$url = ' http://suggestion.baidu.com/su?wd= ';//server to get data $url=$_ Get[' SC '];//page data address, from the server to get function Getjsonstr ($STR) {return substr ($STR, 17);} function Crul ($key) {global $url; $data = file_get_contents ($url. $key); $data = Getjsonstr ($data); $data = Str_replace ("{q : \ "", "", $data); $data = Str_replace ("\", P: "," {%aaa%} ", $data), $data = Str_replace (", s:["," {%aaa%} ", $data); $data = Str_ Replace ("]}),", "", $data), $arr = Explode ("{%aaa%}", $data), $res = Array (), $res [' q '] = Iconv ("GB2312", "UTF-8", $arr [0]); if ($arr [1] = = ' true ') {$arr [1] = true;} else{$arr [1] = false;} $res [' p '] = $arr [1];if (Strlen ($arr [2]) >0) {$arr [2] = substr ($arr [2],1,-1); $arr [2] = Str_replace ("\", \ "", ",", $arr [2 ]); $arr [2] = Iconv ("GB2312", "UTF-8", $arr [2]);} $res [' s '] = explode (', ', $arr [2]); Echo Json_encode ($res);//json_encode () Convert to JSON string} $key = $_request[' wd '];crul ($key) ;? >
Baidu Search effect (the page came from the data address, by the server to get)