Code to query search engine ranking position using PHP_PHP tutorial

WBOY
Release: 2016-07-21 15:41:58
Original
970 people have browsed it

Copy code The code is as follows:

/*
Query Google "Shenzhen Photography Studio", Ranking position of LANSJ; 2009-10-11
lost63.com original
Search in the first 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 'Page '.$n.' not found
';
}
fclose($file);
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321024.htmlTechArticleCopy the code as follows: ?php /* Query the ranking position of "Shenzhen Photography Studio" on Google and LANSJ ; 2009-10-11 lost63.com original search in the first 30 pages*/ $page=30; //Number of pages $dom...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!