Get the Google prvalue code!

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.