|
|
发表于 2015-6-1 20:41:44
|
显示全部楼层
- string url = "http://data.zz.baidu.com/urls?site=www.xxx.com&token=YourToken";4 b& L4 o. J) F+ i! C4 |: C
- string postString = "http://www.xxx.com/abc.aspx";, ^: c7 ?3 R! s; O; s: \8 V$ N/ ?+ L
- byte[] postData = Encoding.UTF8.GetBytes(postString);, J5 V* T D& x9 r
- WebClient myWebClient = new WebClient();
' W( I$ Z: P2 z1 o: h - myWebClient.Headers.Add("UserAgent", "curl/7.12.1");
4 J/ v+ _1 j \- @ - myWebClient.Headers.Add("Content-Type", "text/plain");
- {/ R6 m( K5 R8 _ J5 _7 ?' U* p5 | - myWebClient.Credentials = CredentialCache.DefaultCredentials;
. p: z6 P* E6 ~! r( s - byte[] myDataBuffer = myWebClient.UploadData(url, "post", postData);( p! H( ~' s1 }! s! H$ w
- string strWebData = Encoding.Default.GetString(myDataBuffer);2 u" Z, @4 O0 `; z$ g3 s( n' o
- Response.Write(strWebData);
复制代码
- o% d. _. X! n拿去用,改成自己的URL和token |
评分
-
查看全部评分
|