|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";1 m( M, {, A, i8 [
- string postString = "http://www.xxx.com/abc.aspx";
1 \* f. r2 p; S - byte[] postData = Encoding.UTF8.GetBytes(postString);, ]/ ~* h4 I n% [* }
- WebClient myWebClient = new WebClient();
/ x9 p. k/ O9 |) d, ^3 L8 C) x - myWebClient.Headers.Add("UserAgent", "curl/7.12.1");$ E0 S$ x" p5 F7 I( |, e# v) J8 X
- myWebClient.Headers.Add("Content-Type", "text/plain");- G6 r6 c( K) q( A* e# I- m" C
- myWebClient.Credentials = CredentialCache.DefaultCredentials;
6 K* F. Q. n) h* @; C3 n0 m) H - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);
6 Z3 C4 B0 p3 X! T0 R1 S. q4 f - string strWebData = Encoding.Default.GetString(myDataBuffer);
& b9 { I6 B1 Z) ] - Response.Write(strWebData);
复制代码
( k' E8 w$ m1 f6 O2 m8 C拿去用,改成自己的URL和token |
评分
-
查看全部评分
|