百度链接提交接口
//百度提交了接口,可以自动提交网址,有利于SEO, http://zhanzhang.baidu.com/linksubmit/index?site=http%3A%2F%2Ftaohao.wangzhan360.com.cn/,
//大致流程,1.登陆百度后台,输入要提交的网址
//2.下载百度的验证文件,放到要提交的站点
//3.百度发请求验证这个文件,验证成功,生成一个token
//4.接下来,参考下面代码,程序发请求,完成提交。
//注意:site参数要是你申请的站点,token是该站点的token,一一对应。
// 测试通过的提交代码如下:
string postData = "http://taohao.wangzhan360.com.cn/Default.aspx"; string urls = "http://data.zz.baidu.com/urls?site=taohao.wangzhan360.com.cn&token=rzgs6fs1P8hPCXKu"; byte[] byteArray = Encoding.UTF8.GetBytes(postData); HttpWebRequest objWebRequest = (HttpWebRequest)WebRequest.Create(urls); objWebRequest.Method = "POST"; objWebRequest.ContentType = "text/plain"; objWebRequest.Host = "data.zz.baidu.com"; objWebRequest.UserAgent = "curl/7.12.1"; objWebRequest.ContentType = "text/plain"; objWebRequest.ContentLength = byteArray.Length; Stream newStream = objWebRequest.GetRequestStream(); newStream.Write(byteArray, 0, postData.Length); //写入参数 newStream.Close(); HttpWebResponse response = (HttpWebResponse)objWebRequest.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default); string textResponse = sr.ReadToEnd(); Response.Write(textResponse);