|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";' d: H6 {9 F! Q8 m$ c! P& k" }
- string postString = "http://www.xxx.com/abc.aspx";
. m c, b7 R- M( @ b, ^! U - byte[] postData = Encoding.UTF8.GetBytes(postString);3 L, E5 Y( g$ I+ X5 p: e/ W
- WebClient myWebClient = new WebClient();* }& B( s+ g/ Y! P
- myWebClient.Headers.Add("UserAgent", "curl/7.12.1");5 l7 k( t4 I! E& U0 H
- myWebClient.Headers.Add("Content-Type", "text/plain");/ H8 I* K3 P- w4 V! C+ ^
- myWebClient.Credentials = CredentialCache.DefaultCredentials;3 j) R6 q' g8 m* M! g
- byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);
$ ?; @) ]) V$ v- z - string strWebData = Encoding.Default.GetString(myDataBuffer);
8 A- `9 _6 Y4 H0 Y. t9 a @' X; O - Response.Write(strWebData);
复制代码
$ z6 H8 ] Z" j" I拿去用,改成自己的URL和token |
评分
-
查看全部评分
|