Home  >  Article  >  Backend Development  >  World Search Engine Ranking Use PHP to query search engine ranking position code

World Search Engine Ranking Use PHP to query search engine ranking position code

WBOY
WBOYOriginal
2016-07-29 08:41:381704browse

Copy the code The code is as follows:


/*
Query Google "Shenzhen Photography Studio", the ranking position of LANSJ; 2009-10-11
lost63.com original
first Search 30 pages
*/
$page=30; //Number of pages
$domain="lansj.com"; //Domain name
//$domain="lost63.com";
for($n=0; $n<=$page;$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 'Found on page '.$n.'
';
$n=$page;
}else{
echo 'Found'.$ n.'Page not found
';
}
fclose($file);
}
?>

The above introduces the code for using PHP to query the search engine ranking position in the world search engine rankings, including the content of the world search engine rankings. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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