擷取Google PR值的代碼!

來源:互聯網
上載者:User

最近在整理資料的時候,發現以前多的小工具包括網站的pr值以及搜尋的數量等模仿於站長工具的功能。下面是一個可以計算出一個網站在google中pr值是多少的代碼,希望對大家有用以及能協助大家!如果有什麼問題可以交流!謝謝

 

 

//這是驗證網址pr值的串連
http://www.google.cn/search?client=navclient-auto&ch=6-1385476800&features=Rank&q=info:www.baidu.com

//這是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;
        }
    }

}

有興趣的可以實驗一下

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.