Home > php教程 > php手册 > 用PHP查询搜索引擎排名位置的代码

用PHP查询搜索引擎排名位置的代码

WBOY
Release: 2016-06-13 12:19:53
Original
905 people have browsed it

复制代码 代码如下:


/*
查询谷歌"深圳摄影工作室",岚视界LANSJ的排名位置; 2009-10-11
lost63.com原创
在前30页中搜索
*/
$page=30; //页面数
$domain="lansj.com"; //域名
//$domain="lost63.com";
for($n=0;$n$url='http://www.google.cn/search?hl=zh-CN&newwindow=1&q=%E6%B7%B1%E5%9C%B3%E6%91%84%E5%BD%B1%E5%B7%A5%E4%BD%9C%E5%AE%A4&start='.$n.'0&sa=N';
//$url='http://www.google.cn/search?hl=zh-CN&lr=&newwindow=1&q=%E8%BF%B7%E5%A4%B1%E8%B7%AF%E4%B8%8A&start='.$n.'0&sa=N';
$file=fopen($url,"r");
while(!feof($file))
{
$result.=fgets($file,9999);
}
if(strpos($result,$domain)==true){
echo '在第'.$n.'页找到喽
';
$n=$page;
}else{
echo '第'.$n.'页没有找到
';
}
fclose($file);
}
?>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template