PR值查询代码制作
程序员文章站
2022-07-02 08:45:25
复制代码 代码如下:<%@language="vbscript" codepage="936"%>
<%@language="vbscript" codepage="936"%>
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>google pr值查询程序</title>
</head>
<body><h3>输入网址,查询google pagerank值</h3>
<form name="form1" method="post" action="?act=ok">
<p>输入网址
<input type="text" name="domain">
<input type="submit" name="submit" value="提交">
</p>
</form>
<%
if trim(request.querystring("act"))="ok" then
domain=trim(request.form("domain"))
if domain<>"" then
response.write("<b>"&domain&"</b> 的google pagerank值为<font color=red>"&getpr(domain)&"</font>")
end if
end if
function getpr(domain)
getcontent=geturl("http://so.5eo.com/pr/rank.asp?domain="&domain)
getprline=regexptext(getcontent,"在google pagerank满分10分评价中获得.*(\\d).*分")
getpr=regexptext(getprline,"\\s\\d\\s")
end function
function bstr(vin)
dim strreturn,i,thischarcode,innercode,hight8,low8,nextcharcode
strreturn = ""
for i = 1 to lenb(vin)
thischarcode = ascb(midb(vin,i,1))
if thischarcode < &h80 then
strreturn = strreturn & chr(thischarcode)
else
nextcharcode = ascb(midb(vin,i+1,1))
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
i = i + 1
end if
next
bstr = strreturn
end function
function geturl(url)
set retrieval = server.createobject("microsoft.xmlhttp")
with retrieval
.open "get", url, false
.setrequestheader "content-type","application/x-www-form-urlencoded"
.send
geturl = .responsebody
end with
set retrieval = nothing
geturl=bstr(geturl)
end function
function regexptext(strng,regstr)
'dim regex, match, matches ' 建立变量。
set regex = new regexp ' 建立正则表达式。
regex.pattern = regstr ' 设置模式。
regex.ignorecase = true ' 设置是否区分字符大小写。
regex.global = true ' 设置全局可用性。
set matches = regex.execute(strng) ' 执行搜索。
for each match in matches ' 遍历匹配集合。
retstr = retstr & match.value'&"|||"
next
regexptext = retstr
set regex=nothing
end function
%>
</body>
</html>
复制代码 代码如下:
<%@language="vbscript" codepage="936"%>
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>google pr值查询程序</title>
</head>
<body><h3>输入网址,查询google pagerank值</h3>
<form name="form1" method="post" action="?act=ok">
<p>输入网址
<input type="text" name="domain">
<input type="submit" name="submit" value="提交">
</p>
</form>
<%
if trim(request.querystring("act"))="ok" then
domain=trim(request.form("domain"))
if domain<>"" then
response.write("<b>"&domain&"</b> 的google pagerank值为<font color=red>"&getpr(domain)&"</font>")
end if
end if
function getpr(domain)
getcontent=geturl("http://so.5eo.com/pr/rank.asp?domain="&domain)
getprline=regexptext(getcontent,"在google pagerank满分10分评价中获得.*(\\d).*分")
getpr=regexptext(getprline,"\\s\\d\\s")
end function
function bstr(vin)
dim strreturn,i,thischarcode,innercode,hight8,low8,nextcharcode
strreturn = ""
for i = 1 to lenb(vin)
thischarcode = ascb(midb(vin,i,1))
if thischarcode < &h80 then
strreturn = strreturn & chr(thischarcode)
else
nextcharcode = ascb(midb(vin,i+1,1))
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
i = i + 1
end if
next
bstr = strreturn
end function
function geturl(url)
set retrieval = server.createobject("microsoft.xmlhttp")
with retrieval
.open "get", url, false
.setrequestheader "content-type","application/x-www-form-urlencoded"
.send
geturl = .responsebody
end with
set retrieval = nothing
geturl=bstr(geturl)
end function
function regexptext(strng,regstr)
'dim regex, match, matches ' 建立变量。
set regex = new regexp ' 建立正则表达式。
regex.pattern = regstr ' 设置模式。
regex.ignorecase = true ' 设置是否区分字符大小写。
regex.global = true ' 设置全局可用性。
set matches = regex.execute(strng) ' 执行搜索。
for each match in matches ' 遍历匹配集合。
retstr = retstr & match.value'&"|||"
next
regexptext = retstr
set regex=nothing
end function
%>
</body>
</html>