|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";
- y9 h* o' d* d8 u" h0 k* c" l - string postString = "http://www.xxx.com/abc.aspx";+ ^ J9 k7 X) k& n: d8 l6 R! e3 G
- byte[] postData = Encoding.UTF8.GetBytes(postString);
% a9 F. ?- H4 I6 _1 b- ]& V# s/ i - WebClient myWebClient = new WebClient();: f' I" c% h) w' N R- t; k {8 w9 G
- myWebClient.Headers.Add("UserAgent", "curl/7.12.1");
' E7 Q1 D! Y( |5 ]* j - myWebClient.Headers.Add("Content-Type", "text/plain");& m( R! o. O! W: j
- myWebClient.Credentials = CredentialCache.DefaultCredentials;
# h) W& c% Y2 y6 G2 P - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);1 c/ @ `5 J2 I* X; Z
- string strWebData = Encoding.Default.GetString(myDataBuffer);
0 q, o7 ]5 n y1 F8 H" H0 a, ? - Response.Write(strWebData);
复制代码
- k4 e" T! P9 b拿去用,改成自己的URL和token |
评分
-
查看全部评分
|