<%
If request("d")="" Then
Response.Redirect "mypr.asp?d=xamq.com"
End If
dim weburl
'请修改为你的网址
weburl="xamq.com"
'远程截取函数开始
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
        t = GetBody(Path)
        getHTTPPage=BytesToBstr(t,"utf-8")
End function

Function GetBody(url) 
        on error resume next
        Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
        With Retrieval 
        .Open "Get", url, False, "", "" 
        .Send 
        GetBody = .ResponseBody
        End With 
        Set Retrieval = Nothing 
End Function

Function BytesToBstr(body,Cset)
        dim objstream
        set objstream = Server.CreateObject("ado"&"db.str"&"eam")
        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
Function Newstring(wstr,strng)
        Newstring=Instr(lcase(wstr),lcase(strng))
        if Newstring<=0 then Newstring=Len(wstr)
End Function
'
Function del(str)
    str=replace(str,"has Google PageRank","")
    str=replace(str,"out of 10","")
    str=replace(str," ","")
del=str
End Function
dim wd
wd=Request("d")
'截取网址
url="http://www.xamq.com/tj/index/images/MY/pr.asp?site="&wd&""
        wstr=getHTTPPage(url)
'截取数据
set reg=new Regexp
	reg.Multiline=True
	reg.Global=Flase
	reg.IgnoreCase=true
	reg.Pattern="<pagerank>((.|\n)*?)</pagerank>"
	Set matches = reg.execute(wstr)
		For Each match1 in matches
			bodypage=match1.Value
		Next
Set matches = Nothing
Set reg = Nothing
bodypage=Replace(bodypage,"<pagerank>","")
bodypage=Replace(bodypage,"</pagerank>","")
%>
<html><head>
<title><%=Request("d")%>的Google PageRank综合排名查询结果</title>
<meta name="robots" content="noindex,nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<body leftmargin=0 topmargin=0>
<%
if request("s")<>"0" then
Response.Write "<a href=""/tj/index/images/MY/mypr.asp?d="&wd&""" target=""_blank"" style=""width:80px;height:15px;border:0px;"" title=""PageRank"" align=absmiddle><img src=""1pagerank"&bodypage&".gif"" border=0></a>"
end if
%>
</div></body></html> 
