PR值查詢代碼製作_應用技巧

來源:互聯網
上載者:User
複製代碼 代碼如下:

<%@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。 
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>


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.