用c#写个软件,不知道谷歌的接口用c#写感觉太麻烦了
于是在csdn下载了一份代码,改成用软件查询的接口。
https://www.xssxss.com/pr.php?url=www.google.com
代码
<?php
$url= $_get[‘url’];
// url get method macro.
define(‘g_pr_get_type_file’, 1); // u fopen() function
define(‘g_pr_get_type_socket’, 2); // u standard fsocketopen functi生命之爱on
// main function to be called
function getpr($_url,$gettype=g_pr_get_type_socket){
$url = ‘info:’.$_url;
$ch = gch(strord($url));
$ch = newgch($ch);
$url=str_replace(“_”,”%5f”,’info:’.urlencode($_url));
$googleprurl =
“https://toolbarqueries.google.com/tbr?client=暗恋测试nalient-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));
}
el{
$a = ($a>>$b);
}
return $a;
}
// discard bits beyonds 32 bit.
function trunkbitforce32bit($n){
if(php_int_size <= 4){
ttype($n,’float’);
if ( $n < 0 ) $n += 4294967296;
return $n;
}
el{
$clearbit = ”;
for($i=0;$i<php_int_size-4;$i++){
$clearbit .= ’00’;
}
for($i=0;$i<4;$i++){
$clearbit .= ‘ff’;
}
return ($n & hexdec($clearbit));
}
}
function bigxor($m,$n){
//if(function_exists(‘gmp_init’)){
// return floatval(gmp_strval(gmp_xor($m,$n)));
//}
//el{
return $m ^ $n;
//}
}
function mix($a,$b,$c){
$a = trunkbitforce32bit($a);
$b = trunkbitforce32bit($b);
$c = trunkbitforce32bit($c);
$a -= $b; $a = trunkbitforce32bit($a);
$a -= $c; $a = trunkbitforce32bit($a);
$a = bigxor($a,(zerofill($c,13))); $a = trunkbitforce32bit($a);
$b -= $c; $b = trunkbitforce32bit($b);
$b -= $a; $b = trunkbitforce32bit($b);
$b = bigxor($b,trunkbitforce32bit($a<<8)); $b = trunkbitforce32bit($b);
$c -= $a; $c = trunkbitforce32bit($c);
$c -= $b; $c = trunkbitforce32bit($c);
$c = bigxor($c,(zerofill($b,13))); $c = trunkbitforce32bit($c);
$a -= $b;$a = trunkbitforce32bit($a);
$a -= $c;$a = trunkbitforce32bit($a);
$a = bigxor($a,(zerofill($c,12)));$a = trunkbitforce32bit($a);
$b -= $c;$b = trunkbitforce32bit($b);
$b -= $a;$b = trunkbitforce32bit($b);
$b = bigxor($b,trunkbitforce32bit($a<<16));
$c -= $a; $c = trunkbitforce32bit($c);
$c -= $b; $c = trunkbitforce32bit($c);
$c = bigxor($c,(zerofill($b,5))); $c = trunkbitforce32bit($c);
$a -= $b;$a = trunkbitforce32bit($a);
$a -= $c;$a = trunkbitforce32bit($a);
$a = bigxor($a,(zerofill($c,3)));$a = trunkbitforce32bit($a);
$b -= $c;$b = trunkbitforce32bit($b);
$b -= $a;$b = trunkbitforce32bit($b);
$b = bigxor($b,trunkbitforce32bit($a<<10));
$c -= $a; $c = trunkbitforce32bit($c);
$c -= $b; $c = trunkbitforce32bit($c);
$c = bigxor($c,(zerofill($b,15))); $c = trunkbitforce32bit($c);
return array($a,$b,$c);
}
function newgch($ch){
$ch = ( trunkbitforce32bit( ( $ch / 7 ) << 2 ) |
( ( myfmod( $ch,13 ) ) & 7 ) );
$prbuf = array();
$prbuf[0] = $ch;
for( $i = 1; $i < 20; $i++ )
{
$prbuf[$i] = $prbuf[$i-1] – 9;
}
$ch = gch( c32to8bit( $prbuf ) );
return $ch;
}
function myfmod($x,$y){
$i = floor( $x / $y );
return ( $x – $i * $y );
}
function c32to8bit($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 ) {
ca 11:
$c += trunkbitforce32bit($url[$k+10]<<24);
ca 10:
$c+=trunkbitforce32bit($url[$k+9]<<16);
ca 9 :
$c+=trunkbitforce32bit($url[$k+8]<<8);
ca 8 :
$b+=trunkbitforce32bit($url[$k+7]<<24);
ca 7 :
$b+=trunkbitforce32bit($url[$k+6]<<16);
ca 6 :
$b+=trunkbitforce32bit($url[$k+5]<<8);
ca 5 :
$b+=trunkbitforce32bit($url[$k+4]);
ca 4 :
$a+=trunkbitforce32bit($url[$k+3]<<24);
ca 3 :
$a+=trunkbitforce32bit($url[$k+2]<<16);
ca 2 :
$a+=trunkbitforce32bit($url[$k+1]<<8);
ca 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] );
}
el{
return $mixo[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;
}
// return url page content or fal if failed.
function retrieveurlcontent($url,$gettype){
switch($gettype){
ca g_pr_get_type_file:
return retrieveurlcontentbyfile($url);
break;
default:
return retrieveurlcontentbysocket($url);
break;
}
}
function retrieveurlcontentbyfile($url){
$fd = @fopen($url,”r”);
if(!$fd){
return fal;
} www.2cto.com
$result = “”;
while($buffer = fgets($fd, 4096)) {
$result .= $buffer;
}
fclo($fd);
return $result;
}
function retrieveurlcontentbysocket($url,
$host=””,
$port=80,
串词 $timeout=30){
if($host == “”){
if(!($pos = strpos($url,’://’))){
return fal;
}
$host = substr( $url,
$pos+3,
strpos($url,’/’,$pos+3) 中秋节日祝福短信8211; $pos – 3);
$uri = substr($url,strpos($url,’/’,$pos+3));
}
el{
$uri = $url;
}
$request = “get “.$uri.” http/1.0\r\n”
.”host: “.$host.”\r\n”
.”accept: */*\r\n”
.”ur-agent: zealget\r\n”
.”\r\n”;
$shnd = @fsockopen ($host, $port, $errno, $errstr, $timeout);
if(!$shnd){
return fal;
}
@fputs ($shnd, $request);
// get source
$result = “”;
while (!feof($shnd)){
$result .= fgets($shnd,4096);
}
fclo($shnd);
$headerend = strpos($result,”\r\n\r\n”);
if (is_bool($headerend))
{
return $result;
}
el{
return substr($result,$headerend+4);
}
}
echo getpr($url);
?>
摘自shine的圣天堂-〃敏〃
本文发布于:2023-04-07 05:53:48,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/bacf8907d93c4802f5fa87fbad9348c1.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:PHP获取PR值的代码.doc
本文 PDF 下载地址:PHP获取PR值的代码.pdf
留言与评论(共有 0 条评论) |