CopyCodeThe Code is as follows: <? PHP
/*
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 <br> ';
$ N = $ page;
} Else {
Echo 'nth. $ n. 'page not found <br> ';
}
Fclose ($ file );
}
?>