|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";+ d% s0 w/ `6 v/ x- ^" s# X
- string postString = "http://www.xxx.com/abc.aspx";
- V6 ~. ]! X' ?* r; Q; `, I - byte[] postData = Encoding.UTF8.GetBytes(postString);/ W2 `5 l/ j# ~/ t. D, t
- WebClient myWebClient = new WebClient();4 O9 D* \# Q) R$ D
- myWebClient.Headers.Add("UserAgent", "curl/7.12.1");4 L8 a/ k# \( F+ ~
- myWebClient.Headers.Add("Content-Type", "text/plain");
3 [3 u# T1 \( |9 p- g4 }8 u8 Q. P: K U - myWebClient.Credentials = CredentialCache.DefaultCredentials;
$ ?' L @# y: R4 ~% [+ w8 v( p - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);9 R/ M5 y4 v/ D6 l' q- r; s- U
- string strWebData = Encoding.Default.GetString(myDataBuffer);$ i; c* T4 m0 \3 p9 \5 [% c% }
- Response.Write(strWebData);
复制代码
) v2 N! w3 x7 d: R% g) d3 c. p拿去用,改成自己的URL和token |
评分
-
查看全部评分
|