|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";/ W- P8 C' x) `& w
- string postString = "http://www.xxx.com/abc.aspx";! a; e. q' _* s+ L& l
- byte[] postData = Encoding.UTF8.GetBytes(postString);6 ?0 g7 ]% {6 X) S
- WebClient myWebClient = new WebClient();
7 M* z) f0 Z9 Y4 a- t% ~) D& W - myWebClient.Headers.Add("UserAgent", "curl/7.12.1");% v$ j9 g5 X/ h" v+ B
- myWebClient.Headers.Add("Content-Type", "text/plain");3 B* R* P9 }( h6 F) z4 i
- myWebClient.Credentials = CredentialCache.DefaultCredentials;8 @8 S7 y* X; Q8 I" R$ j
- byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData); O, U7 c8 e" o
- string strWebData = Encoding.Default.GetString(myDataBuffer);
5 E5 O$ k. F' O Z9 } - Response.Write(strWebData);
复制代码
& T: R9 [2 L( j9 Z5 N4 {8 q! G& [拿去用,改成自己的URL和token |
评分
-
查看全部评分
|