Use PHP to query the code of the search engine ranking position. Copy the code as follows :? Php * query the ranking position of LANSJ in Google's Shenzhen photography studio; 2009-10-11lost63.com original search on the first 30 pages * $ page30; page count $ dom
The code is as follows:
/*
Query the ranking position of LANSJ in Google "Shenzhen Photography Studio", Lan Shi;
Lost63.com original
Search for 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% 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 the'. $ n. 'page
';
$ N = $ page;
} Else {
Echo 'nth. $ n. 'page not found
';
}
Fclose ($ file );
}
?>
The http://www.bkjia.com/PHPjc/321024.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/321024.htmlTechArticle code is as follows :? Php/* query the ranking position of LANSJ in Google's "Shenzhen Photography Studio", Lan Shi; lost63.com original search on the first 30 pages */$ page = 30; // Number of pages $ dom...