|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";: E* N. [/ n. _7 B
- string postString = "http://www.xxx.com/abc.aspx";
% @# v& Q+ r/ m$ {7 n - byte[] postData = Encoding.UTF8.GetBytes(postString);( g$ ?8 S+ w& M& h7 n9 B
- WebClient myWebClient = new WebClient();! j6 d$ ]2 g1 U* ^, v( Q% V' U h
- myWebClient.Headers.Add("UserAgent", "curl/7.12.1");
6 {4 T* ~7 k: o4 u# X0 J - myWebClient.Headers.Add("Content-Type", "text/plain");
) M, g9 _! o6 O8 o* b( ]9 \ - myWebClient.Credentials = CredentialCache.DefaultCredentials;
6 I; x4 ]. p$ V1 q- F! i( @1 R - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData); w8 Q8 D4 k' `" g7 v, |2 c
- string strWebData = Encoding.Default.GetString(myDataBuffer);7 I, b% Y. l* O7 N
- Response.Write(strWebData);
复制代码 # @# r. t# q( g) O( H
拿去用,改成自己的URL和token |
评分
-
查看全部评分
|