Recently, I found that many of my previous gadgets, including the PR value of the website and the number of searches, mimic the functions of webmaster tools. The following is a code that can calculate the PR value of a website in Google. I hope it will be useful to you and help you! If you have any questions, please contact us! Thank you.
// This is the connection to verify the URL prvalue
Http://www.google.cn/search? Client = navclient-Auto & Ch = 6-1385476800 & features = rank & Q = info: www.baidu.com
// This is the source code tested in C #.
<% @ Webhandler Language = "C #" class = "googlepr" %>
Using system;
Using system. Web;
Using system. net;
Public class googlepr: ihttphandler {
Public void processrequest (httpcontext context)
{
Context. response. contenttype = "text/html ";
String u = (context. Request. Form ["U"] + ""). Trim (), Rank = "0 ";
If (u! = "")
{
WebClient WC = new WebClient ();
String Pr = WC. downloadstring ("http://www.google.cn/search? Client = navclient-Auto & Ch = 6-1385476800 & features = rank"
+ "& Q = info:" + U );
WC. Dispose ();
String [] rs = Pr. Split (':');
Rank = Rs [RS. Length-1];
}
Context. response. Write (rank );
}
Public bool isreusable
{
Get
{
Return false;
}
}
}
If you are interested, try it out.