Using HttpClient to send requests and receive responses is simple, just a few steps below.
1. Create the HttpClient object.
2. Create a HttpGet object if you need to send a GET request, or create a HttpPost object if you need to send a POST request.
3. If you need to send request parameters, you can call the HttpGet, HttpPost common setparams (Hetpparams params) method to add the request parameters, and for HttpPost objects, you can also call Setentity ( Httpentity entity) method to set the request parameters.
4. Call the Execute (httpurirequest request) of the HttpClient object to send the request, and execute the method to return a HttpResponse.
5. Call HttpResponse's Getallheaders (), Getheaders (String name) and other methods to get the server's response header; call HttpResponse getentity () The Httpentity method gets the object that wraps the server's response content. This object is used by the program to obtain the server's response content.
HttpClient Usage Summary