|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";, M. [+ a: ?( |( a& x X$ X
- string postString = "http://www.xxx.com/abc.aspx";
. G3 B4 v9 ?, |8 H1 x - byte[] postData = Encoding.UTF8.GetBytes(postString);
7 y; |2 D# K$ B9 _2 P - WebClient myWebClient = new WebClient();
( h I- V. ~$ ?( j - myWebClient.Headers.Add("UserAgent", "curl/7.12.1");, L; m" f2 x" w1 Z
- myWebClient.Headers.Add("Content-Type", "text/plain");
+ c3 W4 o# j) L, W3 U - myWebClient.Credentials = CredentialCache.DefaultCredentials;
' l' {7 S; p$ u - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);* I/ A' h' g9 K9 F" W$ T
- string strWebData = Encoding.Default.GetString(myDataBuffer);/ \$ z6 J$ i* N2 K+ T
- Response.Write(strWebData);
复制代码
5 z. f7 N1 [; D! u% |; T拿去用,改成自己的URL和token |
评分
-
查看全部评分
|