ASP写的谷歌PR老是无法获取求帮助

Liuyc 2010-10-29 10:34:28
pr.php
<?php
/*
if( $_SERVER['HTTP_HOST'] == 'pr.wofav.cn' )
{
header("Location: http://pr.wofav.cn/");
exit();
}
*/
/*
*功能:对URL进行编码
*参数说明:$web_url 网站URL,不包含"http://",例如pr.wofav.cn
*完成时间:2009年4月10日
*/
function HashURL($url)
{$SEED = "Mining PageRank is AGAINST GOOGLE'S TERMS OF SERVICE. Yes, I'm talking to you, scammer.";
$Result = 0x01020345;
for ($i=0; $i<strlen($url); $i++)
{
$Result ^= ord($SEED{$i%87}) ^ ord($url{$i});
$Result = (($Result >> 23) & 0x1FF) | $Result << 9;
}
return sprintf("8%x", $Result);
}


/*
*功能:获取pagerank
*参数说明:$domain 网站域名,不包含"http://",例如pr.wofav.cn
*完成时间:2009年9月19日
*/
function pagerank($domain)
{
$StartURL = "http://www.google.com/search?client=navclient-auto&features=Rank:&q=info:";

$GoogleURL = $StartURL.$domain. '&ch='.HashURL($domain);

$fcontents = file_get_contents("$GoogleURL");

$pagerank = substr($fcontents,9);
if (!$pagerank) return "0";else return $pagerank;
}

$chaxun_bool = 0;

if ( isset($_GET['website']) )
{
$chaxun_bool = 1;

$website = $_GET['website'];
$website = str_replace("http://","",$website);

@ $pr = pagerank("$website");
@ date_default_timezone_set(PRC);

$now_date = date("Y年n月j日 G时i分s秒");
}
?>
<?php
if( $chaxun_bool == 0 )
{
echo '';
}
else
{
echo $pr;
}
?>


获取pr页面


lseif sl="pr" then
PRCldeContent =getHTTPPage("pr.php?website="&sw&) '要提取页面的url地址
Startyahoo="/images/pagerank"
Overyahoo=".gif"
mmm=GetBody(PRCldeContent,Startyahoo,Overyahoo,IncluL,IncluR)
mmm=replace(mmm,chr(10),"")

<%
Function GetHttpPage(HttpUrl)
If IsNull(HttpUrl)=True Then
response.Write("请输入网址!")
Exit Function
End If
On Error Resume Next
Dim Http
Set Http=server.createobject("MSX"&"ML2.XML"&"HTTP")
Http.open "GET",HttpUrl,False
Http.Send()
If Http.Readystate<>4 then
Set Http=Nothing
response.Write("该网页无法访问!")
Exit function
End if
if InStr(bytesToBSTR(Http.responseBody,"UTF-8"),"charset=")=0 then
GetHTTPPage=bytesToBSTR(Http.responseBody,"gb2312")
else
if left(split(bytesToBSTR(Http.responseBody,"UTF-8"),"charset=")(1),6)="gb2312" or left(split(bytesToBSTR(Http.responseBody,"UTF-8"),"charset=")(1),6)="GB2312" then
GetHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
elseif left(split(bytesToBSTR(Http.responseBody,"UTF-8"),"charset=")(1),3)="gbk" or left(split(bytesToBSTR(Http.responseBody,"UTF-8"),"charset=")(1),3)="GBK" then
GetHTTPPage=bytesToBSTR(Http.responseBody,"GBK")
elseif left(split(bytesToBSTR(Http.responseBody,"UTF-8"),"charset=")(1),5)="utf-8" or left(split(bytesToBSTR(Http.responseBody,"UTF-8"),"charset=")(1),5)="UTF-8" then
GetHTTPPage=bytesToBSTR(Http.responseBody,"UTF-8")
else
GetHTTPPage=bytesToBSTR(Http.responseBody,"gb2312")
end if
end if
Set Http=Nothing
If Err.number<>0 then
Err.Clear
End If
End Function

Function BytesToBstr(Body,Cset)
Dim Objstream
Set Objstream = Server.CreateObject("adod"&"b.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
%>
不知道对不对 大家帮忙改正下 我的QQ36032075
直接输入网站 pr.php?website=http://***** 可以获取到pr
在线等结果
...全文
167 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
谷歌自己的服务器的问题。
Liuyc 2010-10-30
  • 打赏
  • 举报
回复
为什么还没有人回答啊 高手呢?
Liuyc 2010-10-30
  • 打赏
  • 举报
回复
自己顶一下 为什么没有人回答啊

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧