在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
时间忙,简单些,直接贴代码上图 百度站长平台为站长提供链接提交通道,您可以提交想被百度收录的链接,百度搜索引擎会按照标准处理 http://zhanzhang.baidu.com/linksubmit/ 推送数据方法 推送接口 POST /urls?site=wanmao.wangzhan360.com.cn&token=M5nqw84uEyFIrrkg HTTP/1.1 http://www.example.com/1.html http://www.example.com/2.html 推送成功 状态码为200,可能返回以下字段:
成功返回示例: { "remain":4999998, "success":2, "not_same_site":[], "not_valid":[] } 推送失败
状态码为4xx,返回字段有:
失败返回示例: { "error":401, "message":"token is not valid" }
1 string postData = "http://www.chinasva.cn/HotNewsDetailed-14.html"; 2 string urls = "http://data.zz.baidu.com/urls?size=www.chinasva.com&token=CpayCbfg33ZeOI5d"; 3 // 要发放的数据 4 5 byte[] byteArray = Encoding.UTF8.GetBytes(postData); 6 HttpWebRequest objWebRequest = (HttpWebRequest)WebRequest.Create(urls); 7 // objWebRequest.ServicePoint.Expect100Continue = false; 8 objWebRequest.Method = "POST"; 9 objWebRequest.ContentType = "text/plain"; 10 objWebRequest.Host = "data.zz.baidu.com"; 11 objWebRequest.UserAgent = "curl/7.12.1"; 12 objWebRequest.ContentType = "text/plain"; 13 //objWebRequest.ContentLength = 83; 14 15 objWebRequest.ContentLength = byteArray.Length; 16 Stream newStream = objWebRequest.GetRequestStream(); 17 // Send the data. 18 newStream.Write(byteArray, 0,postData.Length); //写入参数 19 newStream.Close(); 20 HttpWebResponse response = (HttpWebResponse)objWebRequest.GetResponse(); 21 StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.Default); 22 string textResponse = sr.ReadToEnd(); 23 Response.Write(textResponse);
|
请发表评论