时间:2021-07-01 10:21:17 帮助过:26人阅读
function getContent($url){ $content=file_get_contents($url); return $content; } function getResult($ip){ $pagesize=10; $page=1; $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page"; $result=array(); do { $url="http://cn.bing.com/search?q=ip%3A$ip&first=$page"; $content=getContent($url); $pattern="/([a-zA-Z0-9\.]*)(?:\/.*)?<\/cite>/isU"; preg_match_all($pattern, $content, $matches); $result=array_merge($result,$matches[1]); $nextpage=strpos($content, "下一页"); $page=$page+$pagesize; }while($nextpage); $result=array_values(array_unique($result)); return $result; } // 调用方法 $result=getResult("220.181.111.85"); //$result=getResult("117.79.93.222");//csdn echo ""; print_r($result);