|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";$ |" o( i- \2 `9 \* T
- string postString = "http://www.xxx.com/abc.aspx";
( v4 h* n S( l& C, ? - byte[] postData = Encoding.UTF8.GetBytes(postString);
% I2 a, ~; j8 w' M$ _7 ? - WebClient myWebClient = new WebClient();7 Q" I' e; _& U1 `0 m
- myWebClient.Headers.Add("UserAgent", "curl/7.12.1");
* n1 Y7 O4 z2 n; i - myWebClient.Headers.Add("Content-Type", "text/plain");
3 h! J, S- p. t% B) J9 c - myWebClient.Credentials = CredentialCache.DefaultCredentials;
$ a; R5 Q( H2 j0 X - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);. r! s7 b* V |$ e J2 @+ e, u3 {/ |
- string strWebData = Encoding.Default.GetString(myDataBuffer);3 Z+ O, Z) m, }" C6 U
- Response.Write(strWebData);
复制代码
1 }9 T! h6 o5 v& p2 K拿去用,改成自己的URL和token |
评分
-
查看全部评分
|