Sends a HTTP request and deals with the response.