www.gusucode.com > cso中国seo优化html整站源码程序 > manage/query/mypr.asp

    <%
If request("d")="" Then
Response.Redirect "mypr.asp?d=173158.net"
End If
dim weburl
'请修改为你的网址
weburl="173158.net"
'远程截取函数开始
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://pc.netsoz.com/api/pagerank:"&wd&".xml"
        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 PR值</title>
<meta name="robots" content="noindex,nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta content="Copyright 2007 netsoz.com" name="Copyright" />
<meta content="Hans He" name="Author"></head>
<style type="text/css">
body{background:#DDD;margin:0;padding:0;border:0;}
html,body{height:100%;}
img{margin:2px;}
</style>
<body height="100%">
<table height="100%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr height="100%"><td height="100%" align="center">
<%
if request("s")<>"0" then
Response.Write "<img src=""1pagerank"&bodypage&".gif"" />"
end if
%>
</td></tr>
</table>
</body></html>