Use cURL library for HTTP request if available. A lot faster for big responses. Switched http response handling to respect the defined format.