How to Make a Http GET request and read response
Steps to make a HTTP GET request- Make URL object.
- Make HttpURLConnection object from URL object and type cast it to HttpURLConnection
- Set Request method to GET.
- Add Headers using method setRequestProperty() if required.
- Use BufferedReader to read the input stream of the connection.
- Read the response from buffered reader object.
The code to implement the above steps is shown below.
Comments
Post a Comment