- 精品下载 | 实用查询 | 词典查询 | 桌面壁纸 | 网址 | 笑话 | FLASH频道 | 天气文章资讯 | 站长工具 | 证件办理 | 闪字生成 | 广告代码 | 在线手册 | 有问必答
您现在的位置: 蓝派网 >> 文章中心 >> 网络编程 >> PHP >> 正文
站内文章搜索:           

模拟Google ToolBar直接提交PageRank请求

作者:佚名    文章来源:网络    更新时间 :2008-7-7 17:41:33
l[$k+10]<<24);
        case 10: $c+=($url[$k+9]<<16);
        case 9 : $c+=($url[$k+8]<<8);
          /* the first byte of c is reserved for the length */
        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]);
         /* case 0: nothing left to add */
    }
    $mix = mix($a,$b,$c);
    /*-------------------------------------------- report the result */
    return $mix[2];
}

//converts a string into an array of integers containing the numeric value of the char
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);
  //$ip = gethostbyname("www.google.com");
  //$fp = fsockopen ($ip, 80, $errno, $errstr, 30);

  if (!$fp)
  {
    echo "$errstr ($errno)\n";
    exit(1);
  }
  else
  {
    //$out = "GET $link HTTP/1.1\r\n";
    $out = "GET $link HTTP/1.0\r\n";
    $out .= "Host: toolbarqueries.google.com\r\n";
    $out .= "User-Agent: Mozilla/4.0 (compatible; GoogleToolbar 2.0.114.9-big; Windows 5.2)\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
   
    //while (!feof($fp))
    //  echo fgets ($fp,128);
   
    do{
       $line = fgets($fp, 128);
    }while ($line !== "\r\n");
    $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);
  return $rankarray[2];
}


$provider = '<br /><br /><small>Provided by <a h ref="http://www.lan27.com/"  target="_blank">lan27.com</ a></s mall>';
if ( isset($_POST['url']) && $_POST['url'] !== '' )
{
  echo 'PageRank: '.GetPR($_POST['url']).$provider;
}
else 
{
  echo "<html><title>Get PageRank From Google.com</title><body>PageRank(PR) Querying Script< br / >";
  echo "<form action='' method='post'>"."<br/>URL:<input name='url' value='http://' type='text' size=40>";
  echo "<input name='submit' type='submit' value='GetPR'></form>".$provider."</body></html>"; 
}


?>

上一页  [1] [2] 


发表评论】【打印此文】【关闭窗口】【点击数:
★好玩的休闲小游戏★
网友评论:
数据载入中,请稍后……