Throw exception on curl exec error

Currently curl_exec errors are not handled. This causes curl error (such as connection error, invalid SSL certificate, etc.) to return null $json (hits line 93).

This patch checks curl_exec return value and throw on error.

Also removed unnecessary double initialization of $status.