Google included query and PR query PHP source code Download _php Tutorial

Source: Internet
Author: User
Tags ord php source code
This content is a query Google included query and PR query php source download Oh, after downloading a little modification can be used oh.

This content is a query Google included query and PR query php source download Oh, after downloading a little modification can be used oh.

function Google ()
{
By scanning Google search results too frequently at the same time, GG will block that IP. So the glacier has temporarily removed this feature.
If you want to open this feature, 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, "

" ," in accordance with "));
if ($PageNum = = "") $PageNum = "0";
echo "$PageNum";
}

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];
}

function is 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 check the PR
function Zerofill ($a, $b)
{
$z = Hexdec (80000000);
if ($z & $a)
{
$a = ($a >>1);
$a &= (~ $z);
$a |= 0x40000000;
$a = ($a >> ($b-1));
}
Else
{
$a = ($a >> $b);
}
return $a;
}

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 one: $c + = ($url [$k +10]<<24);
Case: $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
$result [$i] = Ord ($string {$i});
}
return $result;
}

function READPR ($link)
{
$fp = Fsockopen ("www.google.com", $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";
}


http://www.bkjia.com/PHPjc/445054.html www.bkjia.com true http://www.bkjia.com/PHPjc/445054.html techarticle This content is a query Google included query and PR query php source download Oh, after downloading a little modification can be used oh. This content is with a query Google included query and PR inquiry ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.