|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";
9 B2 o2 Z2 p0 T, O r9 k - string postString = "http://www.xxx.com/abc.aspx";% R+ [/ I) h% l1 ~
- byte[] postData = Encoding.UTF8.GetBytes(postString);; E& _5 ] k, E2 p+ k, l7 l( @
- WebClient myWebClient = new WebClient();
% R* Z S1 {$ q) D - myWebClient.Headers.Add("UserAgent", "curl/7.12.1");; z* \. f J3 Q1 |" U5 C
- myWebClient.Headers.Add("Content-Type", "text/plain");
. @) r2 ~- G$ v# ?$ K" S - myWebClient.Credentials = CredentialCache.DefaultCredentials;
9 c2 S1 ]9 Y6 }: m - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);
0 H4 Y) {# X( Z1 }+ ^; E. }) W - string strWebData = Encoding.Default.GetString(myDataBuffer);* ~! o3 K- f T# n* s- t' i* y
- Response.Write(strWebData);
复制代码
/ f% W! N( V+ O- U7 I- q, X6 q拿去用,改成自己的URL和token |
评分
-
查看全部评分
|