Function google ()
{
// Scan Google search results too frequently at the same time, and GG will block this IP address. Therefore, glaciers temporarily remove this function
// If you want to enable this function, you can add comments to the following line. Thank you!
Echo "0"; return "";
Global $ murl, $ furl;
$ Url = "http://www.google.cn/search? Hl = zh-CN & q = site: $ furl ";
$ Page = file_get_contents ($ url );
// Echo $ page;
$ PageNum = "0 ";
$ PageNum = str_replace (",", "", cut ($ page, "<p> & nbsp; about <B> ", "</B> items comply "));
If ($ PageNum = "") $ PageNum = "0 ";
Echo "<a href = '". $ url. "'target =' _ blank '> $ PageNum </a> ";
}
Function pr ()
{
Global $ murl, $ furl;
Echo GetPR ("http: // $ furl ");
}
Function cut ($ string, $ start, $ end)
{
$ Message = explode ($ start, $ string );
$ Message = explode ($ end, $ message [1]);
Return $ message [0];
}
// Functions are the same as escape in javascript
Function escape ($ str ){
Preg_match_all ("/[x80-xff]. | [x01-x7f] +/", $ str, $ r );
$ Ar = $ r [0];
Foreach ($ ar as $ k => $ v ){
If (ord ($ v [0]) <128)
$ Ar [$ k] = rawurlencode ($ v );
Else
$ Ar [$ k] = "% u". bin2hex (iconv ("GB2312", "UCS-2", $ v ));
}
Return join ("", $ ar );
}
Function unescape ($ str ){
$ Str = rawurldecode ($ str );
Preg_match_all ("/(? : % U. {4}) |. +/", $ str, $ r );
$ Ar = $ r [0];
Foreach ($ ar as $ k => $ v ){
If (substr ($ v, 0, 2) = "% u" & strlen ($ v) = 6)
$ Ar [$ k] = iconv ("UCS-2", "GB2312", pack ("H4", substr ($ v,-4 )));
}
Return join ("", $ ar );
}
// The following function is used to query pr
Function zeroFill ($ a, $ B)
{
$ Z = hexdec (80000000 );
If ($ z & $)
{
$ A = ($ a> 1 );
$ A & = (~ $ Z );
$ A | = 0x40000000;
$ A = ($ a >>( $ B-1 ));
}
Else
{
$ A = ($ a >>$ B );
}
Return $;
}
Function mix ($ a, $ B, $ c)
{
$ A-= $ B; $ a-= $ c; $ a ^ = (zeroFill ($ c, 13 ));
$ B-= $ c; $ B-= $ a; $ B ^ = ($ a <8 );
$ C-= $ a; $ c-= $ B; $ c ^ = (zeroFill ($ B, 13 ));
$ A-= $ B; $ a-= $ c; $ a ^ = (zeroFill ($ c, 12 ));
$ B-= $ c; $ B-= $ a; $ B ^ = ($ a <16 );
$ C-= $ a; $ c-= $ B; $ c ^ = (zeroFill ($ B, 5 ));
$ A-= $ B; $ a-= $ c; $ a ^ = (zeroFill ($ c, 3 ));
$ B-= $ c; $ B-= $ a; $ B ^ = ($ a <10 );
$ C-= $ a; $ c-= $ B; $ c ^ = (zeroFill ($ B, 15 ));
Return array ($ a, $ B, $ c );
}
Function GoogleCH ($ url, $ length = null, $ init = GOOGLE_MAGIC)
{
If (is_null ($ length ))
{
$ Length = sizeof ($ url );
}
$ A = $ B = 0x9E3779B9;
$ C = $ init;
$ K = 0;
$ Len = $ length;
While ($ len> = 12)
{
$ A + = ($ url [$ k + 0] + ($ url [$ k + 1] <8) + ($ url [$ k + 2] <16) + ($ url [$ k + 3] <24 ));
$ B + = ($ url [$ k + 4] + ($ url [$ k + 5] <8) + ($ url [$ k + 6] <16) + ($ url [$ k + 7] <24 ));
$ C + = ($ url [$ k + 8] + ($ url [$ k + 9] <8) + ($ url [$ k + 10] <16) + ($ url [$ k + 11] <24 ));
$ Mix = mix ($ a, $ B, $ c );
$ A = $ mix [0]; $ B = $ mix [1]; $ c = $ mix [2];
$ K + = 12;
$ Len-= 12;
}
$ C + = $ length;
Switch ($ len)
{
Case 11: $ c ++ = ($ url [$ k + 10] <24 );
Case 10: $ c ++ = ($ url [$ k + 9] <16 );
Case 9: $ c ++ = ($ url [$ k + 8] <8 );
Case 8: $ B + = ($ url [$ k + 7] <24 );
Case 7: $ B + = ($ url [$ k + 6] <16 );
Case 6: $ B + = ($ url [$ k + 5] <8 );
Case 5: $ B + = ($ url [$ k + 4]);
Case 4: $ a + = ($ url [$ k + 3] <24 );
Case 3: $ a + = ($ url [$ k + 2] <16 );
Case 2: $ a + = ($ url [$ k + 1] <8 );
Case 1: $ a + = ($ url [$ k + 0]);
}
$ Mix = mix ($ a, $ B, $ c );
Return $ mix [2];
}
Function strord ($ string ){
For ($ I = 0; $ I <strlen ($ string); $ I ++ ){
$ Result [$ I] = ord ($ string {$ I });
}
Return $ result;
}
Function ReadPR ($ link)
{
$ Fp = fsockopen ("www.google.com", 80, $ errno, $ errstr, 30 );
If (! $ Fp)
{
Echo "$ errstr ($ errno) n ";
Exit (1 );
}
Else
{
$ Out = "GET $ link HTTP/1.0rn ";
$ Out. = "Host: toolbarqueries. google. comrn ";
$ Out. = "User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 2.0.114.9-big; Linux 2.6) rn ";
$ Out. = "Connection: Closernrn ";
Fwrite ($ fp, $ out );
Do {
$ Line = fgets ($ fp, 128 );
} While ($ line! = "Rn ");
$ Data = fread ($ fp, 8192 );
Fclose ($ fp );
Return $ data;
}
}
Function GetPR ($ url)
{
$ Url = 'info: '. $ url;
$ Ch = GoogleCH (strord ($ url ));
$ Data = ReadPR ("/search? Client = navclient-auto & ch = 6 $ ch & features = Rank & q = $ url ");
$ Rankarray = explode (':', $ data );
If (trim ($ rankarray [2])! = ""){
Return $ rankarray [2];
}
Else
Return "0 ";
}