Copy codeThe Code is as follows: <% @ LANGUAGE = "JAVASCRIPT" %>
<Title> Google prvalue query asp program </title>
<%
Function hexdec (str)
{
Return parseInt (str, 16 );
}
Function zeroFill (a, B)
{
Var z = hexdec (80000000 );
If (z &)
{
A = a> 1;
A & = ~ Z;
A | = 0x40000000;
A = a> (b-1 );
}
Else
{
A = a> B;
}
Return ();
}
Function mix (a, B, c)
{
A-= B; a-= c; a ^ = (zeroFill (c, 13 ));
B-= c; B-= a; B ^ = (a <8 );
C-= a; c-= B; c ^ = (zeroFill (B, 13 ));
A-= B; a-= c; a ^ = (zeroFill (c, 12 ));
B-= c; B-= a; B ^ = (a <16 );
C-= a; c-= B; c ^ = (zeroFill (B, 5 ));
A-= B; a-= c; a ^ = (zeroFill (c, 3 ));
B-= c; B-= a; B ^ = (a <10 );
C-= a; c-= B; c ^ = (zeroFill (B, 15 ));
Var ret = new Array (a), (B), (c ));
Return ret;
}
Function GoogleCH (url, length)
{
Var init = 0xE6359A60;
If (arguments. length = 1)
Length = url. length;
Var a = 0x9E3779B9;
Var B = 0x9E3779B9;
Var c = 0xE6359A60;
Var k = 0;
Var len = length;
Var mixo = new Array ();
While (len> = 12)
{
A + = (url [k + 0] + (url [k + 1] <8) + (url [k + 2] <16) + (url [k + 3] <24 ));
B + = (url [k + 4] + (url [k + 5] <8) + (url [k + 6] <16) + (url [k + 7] <24 ));
C + = (url [k + 8] + (url [k + 9] <8) + (url [k + 10] <16) + (url [k + 11] <24 ));
Mixo = mix (a, B, c );
A = mixo [0]; B = mixo [1]; c = mixo [2];
K + = 12;
Len-= 12;
}
C + = length;
Switch (len)
{
Case 11:
C + = url [k + 10] <24;
Case 10:
C + = url [k + 9] <16;
Case 9:
C + = url [k + 8] <8;
Case 8:
B + = (url [k + 7] <24 );
Case 7:
B + = (url [k + 6] <16 );
Case 6:
B + = (url [k + 5] <8 );
Case 5:
B + = (url [k + 4]);
Case 4:
A + = (url [k + 3] <24 );
Case 3:
A + = (url [k + 2] <16 );
Case 2:
A + = (url [k + 1] <8 );
Case 1:
A + = (url [k + 0]);
}
Mixo = mix (a, B, c );
If (mixo [2] <0)
Return (0x100000000 + mixo [2]);
Else
Return mixo [2];
}
Function strord (s)
{
Var re = new Array ();
For (I = 0; I <s. length; I ++)
{
Re [I] = s. charCodeAt (I );
}
Return re;
}
// Source network, www.jb51.net
Function c32to8bit (arr32)
{
Var arr8 = new Array ();
For (I = 0; I <arr32.length; I ++)
{
For (bitOrder = I * 4; bitOrder <= I * 4 + 3; bitOrder ++)
{
Arr8 [bitOrder] = arr32 [I] & 255;
Arr32 [I] = zeroFill (arr32 [I], 8 );
}
}
Return arr8;
}
Function myfmod (x, y)
{
Var I = Math. floor (x/y );
Return (x-I * y );
}
// Source: www. pqshow. com
Function GoogleNewCh (ch)
{
Ch = (ch/7) <2) | (myfmod (ch, 13) & 7 ));
Prbuf = new Array ();
Prbuf [0] = ch;
For (I = 1; I <20; I ++ ){
Prbuf [I] = prbuf [I-1]-9;
}
Ch = GoogleCH (c32to8bit (prbuf), 80 );
Return ch;
}
Function URLencode (sStr)
{
Return encodeURIComponent (sStr). replace (// +/g, "% 2B"). replace (///g, "% 2F ");
}
Function getGoogleHostInfo (url ){
Var reqgr = "info:" + url;
Var reqgre = "info:" + URLencode (url );
// Response. Write (reqgr + "<br>" + reqgre); from the network, www.jb51.net
Gch = GoogleCH (strord (reqgr ));
Gch = "6" + googlewch (gch );
Var querystring = "http://toolbarqueries.google.com/search? Client = navclient-auto & ch = "+ gch +" & ie = UTF-8 & oe = UTF-8 & features = Rank: FVN & q = "+ reqgre;
// Response. Write (querystring); from the network, www.jb51.net
Var objXMLHTTP, xml;
Xml = Server. CreateObject ("Microsoft. XMLHTTP ");
Xml. Open ("GET", querystring, false );
Xml. setRequestHeader ("User-Agent", "Mozilla/4.0 (compatible; GoogleToolbar 2.0.114-big; Windows XP 5.1 )");
Xml. send ();
Return xml. responseText;
}
Function getPageRank (temp ){
Var foo = temp. match (/Rank _.*? :.*? (\ D +)/I );
Var pr = (foo )? Foo [1]: "";
Return pr;
}
Function getDirectory (temp ){
Var foo = temp. match (/FVN _.*? :.*? :(? : Top \/)? ([^ \ S] +)/I );
Var cat = (foo )? Foo [1]: "";
If (cat! = "") Cat = "http://directory.google.com/Top/" + cat
Return cat;
}
// Source network, www.jb51.net
Var site;
Site = "www.baidu.com"; // enter the site name
If (site! = "Undefined "){
Var google = getGoogleHostInfo (site );
Var pagerank = getPageRank (google );
Var directory = getDirectory (google );
Response. Write ("PageRank:" + pagerank + "<br> ");
Response. write ("PageRank: <br> ");
Response. Write ("Site:" + site + "<br> ");
If (directory! = "") Response. Write ("Site: <a href =" + directory + ">" + directory + "</a> <br> ");
}
%>
Save the above Code as pr. asp and run it. If you want to pass parameters, you can
Site = "www.baidu.com"; // enter the site name
Replace
Site = Request. QueryString ("url"); // enter the site name