|
我是用www.baidu.com 这域名测试的
根据不同域名的计算 得出 ch 的值
然后post 如果这个地址。 直接敲这个pr 接口 地址
http://www.google.cn/search?client=navclient-auto&features=Rank:&q=info:http://www.baidu.com&ch=62009202064
返回错误页面。请管理员赐教 谢谢。
string responseFromServer = "";
string s = CalculateChecksum(strUrl);
//try
//{
// HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create(@"http://www.google.cn/search?client=navclient-auto&features=Rank:&q=info:" + strUrl + "&ch=" + s);
// // HttpWReq.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)";
// // HttpWReq.Accept = @"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, */*";
// HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
// Stream dataStream = HttpWResp.GetResponseStream();
// StreamReader reader = new StreamReader(dataStream, System.Text.Encoding.GetEncoding("GB2312"));
// responseFromServer = reader.ReadToEnd();
//}
//catch(Exception ex)
//{
//}
//string[] sp = responseFromServer.Split(':');
//if (sp.Length == 3)
//{
// strResult = "谷歌PR:" + sp[2].ToString();
//}
//else
//{
// strResult = "谷歌PR:0";
//}
string url="http://www.google.cn/search?client=navclient-auto&features=Rank:&q=info:" + strUrl + "&ch=" + s+"";
responseFromServer = GetUrltoHtml(url, 2000);
string[] sp = responseFromServer.Split(':');
if (sp.Length == 3)
{
strResult = "谷歌PR:" + sp[2].ToString();
}
else
{
strResult = "谷歌PR:0";
}
|
|