|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";& d% a4 Y& l5 ?6 V
- string postString = "http://www.xxx.com/abc.aspx";
; `0 e+ c! ^4 Y9 `6 z h/ M$ _ - byte[] postData = Encoding.UTF8.GetBytes(postString);
; ~' C: r c. z5 w# i! l - WebClient myWebClient = new WebClient();
; o/ r- n2 n1 a- ^& p9 s; V - myWebClient.Headers.Add("UserAgent", "curl/7.12.1");8 r/ P- T: D0 d& a3 N- g4 m
- myWebClient.Headers.Add("Content-Type", "text/plain");
% S" {/ \' \( z+ ~# l u - myWebClient.Credentials = CredentialCache.DefaultCredentials;# d/ Q# j) \/ b+ K- J% d6 p
- byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);+ h% j* e7 U# {1 g' p9 ?, a
- string strWebData = Encoding.Default.GetString(myDataBuffer);
! Y6 C+ [( {! ~1 r - Response.Write(strWebData);
复制代码
% O# n o# d9 @: V& Q: k拿去用,改成自己的URL和token |
评分
-
查看全部评分
|