使用HttpClient傳送GET請求
HttpRequestMessage http_req_msg = new HttpRequestMessage();
http_req_msg.Method = HttpMethod.Get;
http_req_msg.Headers.Add("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");
http_req_msg.RequestUri = new Uri("http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl");
HttpClient httpclient;
HttpClientHandler httphandler;
httphandler = new HttpClientHandler();
httphandler.AllowAutoRedirect = false;
httphandler.UseCookies = false;
httpclient = new HttpClient(httphandler);
var task = httpclient.SendAsync(http_req_msg);
task.Result.EnsureSuccessStatusCode();
HttpResponseMessage response = task.Result;
var result = response.Content.ReadAsStringAsync();
string responseBodyAsText = result.Result;
responseBodyAsText = responseBodyAsText.Replace("<br>", Environment.NewLine); // Insert new lines
MessageBox.Show(responseBodyAsText);
相關文章
- 傳送GET請求 示例
- Java用HttpClient3傳送http/https協議get/post請求,傳送map,jsoJavaHTTPclient協議JS
- java apache commons HttpClient傳送get和post請求的學習整理JavaApacheHTTPclient
- postman(二):使用postman傳送get or post請求Postman
- Go使用net/http庫傳送GET請求GoHTTP
- java傳送GET和post請求Java
- SpringMVC中如何傳送GET請求、POST請求、PUT請求、DELETE請求。SpringMVCdelete
- Java用HttpClient3傳送http/https協議get/post請求,傳送map,json,xml,txt資料JavaHTTPclient協議JSONXML
- httprequest- post- get -傳送請求HTTP
- java傳送get請求帶引數Java
- file_get_contents傳送post請求
- 理解ASP.NET Core - 傳送Http請求(HttpClient)ASP.NETHTTPclient
- Go HTTP GET 請求可以傳送 body 嗎GoHTTP
- Angular HTTPClient 傳送請求的觸發方式討論AngularHTTPclient
- Golang:使用go-resty/resty傳送http請求get和postGolangRESTHTTP
- cURL實現傳送Get和Post請求(PHP)PHP
- 043-socket程式設計傳送GET請求程式設計
- 使用Feign傳送HTTP請求HTTP
- 在ASP.NET Core中用HttpClient(三)——傳送HTTP PATCH請求ASP.NETHTTPclient
- nodejs使用request傳送http請求NodeJSHTTP
- HTTP GET請求傳bodyHTTP
- Vue 使用 Axios 傳送請求的請求體問題VueiOS
- vue中使用axios傳送ajax請求VueiOS
- 首頁 使用axios 傳送ajax請求iOS
- 使用requests庫來傳送HTTP請求HTTP
- 使用Postman傳送POST請求的指南Postman
- jQuery裡如何使用ajax傳送請求jQuery
- Vue中通過Axios向SpringBoot傳送get和post請求VueiOSSpring Boot
- python+pytest介面自動化(4)-requests傳送get請求Python
- Java HttpClient 學習記錄 2 嘗試Get請求JavaHTTPclient
- Postman傳送Post請求Postman
- java傳送http請求JavaHTTP
- Java傳送Post請求Java
- Android 傳送HTTP GET POST 請求以及通過 MultipartEntityBuilder 上傳檔案(二)AndroidHTTPUI
- onethink 如何使用get請求?
- 如何傳送請求以及AJAX
- python傳送HTTP POST請求PythonHTTP
- SpringBoot使用Axios傳送請求,引數處理Spring BootiOS
- 使用 request 和 cheerio 庫來傳送 HTTP 請求HTTP