Fix curl error handling
Right now we're checking the result of curl_exec(), which is not appropriate: it will return true for HTTP errors. Need to check explicitly the curl result.
Right now we're checking the result of curl_exec(), which is not appropriate: it will return true for HTTP errors. Need to check explicitly the curl result.