|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";
7 T {- [9 b% g: d* H( k& L+ _ - string postString = "http://www.xxx.com/abc.aspx";
, S1 P5 Y; O/ N: O. ~ - byte[] postData = Encoding.UTF8.GetBytes(postString);
! N( @5 b$ W$ [1 }- ^ - WebClient myWebClient = new WebClient();( W1 i8 d+ U9 E% w( a' `9 l3 ~
- myWebClient.Headers.Add("UserAgent", "curl/7.12.1");
/ K3 ~: j& c0 {, h4 s9 I; t - myWebClient.Headers.Add("Content-Type", "text/plain");
. O- {5 q- h7 h3 d% [ - myWebClient.Credentials = CredentialCache.DefaultCredentials;
" g! Z3 @. o1 x9 r3 s7 D4 H6 i% W - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);; Y# ?6 [& V8 b2 S n9 k* Y
- string strWebData = Encoding.Default.GetString(myDataBuffer);+ A" m( f% Y6 I$ {
- Response.Write(strWebData);
复制代码
) N* g) k# |$ h b3 H+ v% w' ~拿去用,改成自己的URL和token |
评分
-
查看全部评分
|