VPS测评介绍
VPS技术分享

GOOGLE的PR查询接口类


$googlePRUrl =
http://toolbarqueries.google.com/search?client=navclient-auto&ch=6
.$ch.”&ie=UTF-8&oe=UTF-8&features=Rank&q=”.$url;
$pr_str = retrieveURLContent($googlePRUrl,$gettype);
return substr($pr_str,strrpos($pr_str, “:”)+1);
}
//unsigned shift right
function zeroFill($a, $b){
$z = hexdec('8'.implode('',array_fill(0,PHP_INT_SIZE*2-1,'0')));
if ($z & $a){
$a = ($a>>1);
$a &= (~$z);
$a |= hexdec('4'.implode('',array_fill(0,PHP_INT_SIZE*2-1,'0')));
$a = ($a>>($b-1));
}
else{
$a = ($a>>$b);
}
return $a;
}
// discard bits beyonds 32 bit.
function trunkbitForce32bit($n){
if(PHP_INT_SIZE <= 4){ settype($n,'float'); if ( $n < 0 ) $n += 4294967296; return $n; } else{ $clearbit = ''; for($i=0;$iwriting a research paper

to8bit($arr32){
$arr8 = array();
for( $i = 0; $i < count($arr32); $i++ ) { for( $bitOrder = $i * 4; $bitOrder <= $i * 4 + 3; $bitOrder++ ) { $arr8[$bitOrder] = $arr32[$i] & 255; $arr32[$i] = zeroFill( $arr32[$i], 8 ); } } return $arr8; } function GCH($url, $length=null){ if(is_null($length)) { $length = sizeof($url); } $init = 0xE6359A60; $a = 0x9E3779B9; $b = 0x9E3779B9; $c = 0xE6359A60; $k = 0; $len = $length; $mixo = array(); while( $len >= 12 ){
$a += ($url[$k+0] +trunkbitForce32bit($url[$k+1]<<8) +trunkbitForce32bit($url[$k+2]<<16) +trunkbitForce32bit($url[$k+3]<<24)); $b += ($url[$k+4] +trunkbitForce32bit($url[$k+5]<<8) +trunkbitForce32bit($url[$k+6]<<16) +trunkbitForce32bit($url[$k+7]<<24)); $c += ($url[$k+8] +trunkbitForce32bit($url[$k+9]<<8) +trunkbitForce32bit($url[$k+10]<<16) +trunkbitForce32bit($url[$k+11]<<24)); $mixo = mix($a,$b,$c); $a = $mixo[0]; $b = $mixo[1]; $c = $mixo[2]; $k += 12; $len -= 12; } $c += $length; switch( $len ) { case 11: $c += trunkbitForce32bit($url[$k+10]<<24); case 10: $c+=trunkbitForce32bit($url[$k+9]<<16); case 9 : $c+=trunkbitForce32bit($url[$k+8]<<8); case 8 : $b+=trunkbitForce32bit($url[$k+7]<<24); case 7 : $b+=trunkbitForce32bit($url[$k+6]<<16); case 6 : $b+=trunkbitForce32bit($url[$k+5]<<8); case 5 : $b+=trunkbitForce32bit($url[$k+4]); case 4 : $a+=trunkbitForce32bit($url[$k+3]<<24); case 3 : $a+=trunkbitForce32bit($url[$k+2]<<16); case 2 : $a+=trunkbitForce32bit($url[$k+1]<<8); case 1 : $a+=trunkbitForce32bit($url[$k+0]); } $mixo = mix( $a, $b, $c ); $mixo[2] = trunkbitForce32bit($mixo[2]); if( $mixo[2] < 0 ){ return ( hexdec('1'. implode('', array_fill(0,PHP_INT_SIZE*2,'0'))) + $mixo[2] ); } else{ return $mixo[2]; } } // converts a string into an array of integers // containing the numeric value of the char function strord($string){ for($i=0;$iwww.it13.net“);
//最后一句是查询方法的调用示例
?>

zp8497586rq
赞(0)
未经允许不得转载:服务器VPS折腾 » GOOGLE的PR查询接口类