src/HttpClient.php
public function getJSON($url)
    {
        $ch = curl_init($url);

        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, \Cloudinary::userAgent());

        $response = $this->execute($ch);

        $curl_error = null;
        if (curl_errno($ch)) {
            $curl_error = curl_error($ch);
        }

        curl_close($ch);

        if ($curl_error != null) {
            throw new Error("Error in sending request to server - " . $curl_error);
        }

        if ($response->responseCode != 200) {
            throw new Error("Server returned unexpected status code - {$response->responseCode} - {$response->body}");
        }

        return self::parseJSONResponse($response);
    }
public function getJSON($url)
    {
        $ch = curl_init($url);

        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, \Cloudinary::userAgent());

        $response = $this->execute($ch);

        $curl_error = null;
        if (curl_errno($ch)) {
            $curl_error = curl_error($ch);
        }

        curl_close($ch);

        if ($curl_error != null) {
            throw new Error("Error in sending request to server - " . $curl_error);
        }

        if ($response->responseCode != 200) {
            throw new Error("Server returned unexpected status code - {$response->responseCode} - {$response->body}");
        }

        return self::parseJSONResponse($response);
    }
public function getJSON ( $ url ) { $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_HEADER , false ) ; curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , "GET" ) ; curl_setopt ( $ ch , CURLOPT_TIMEOUT , $ this -> timeout ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_USERAGENT , \ Cloudinary :: userAgent ( ) ) ; $ response = $ this -> execute ( $ ch ) ; $ curl_error = null ; if ( curl_errno ( $ ch ) ) { $ curl_error = curl_error ( $ ch ) ; } curl_close ( $ ch ) ; if ( $ curl_error != null ) { throw new Error ( "Error in sending request to server - " . $ curl_error ) ; } if ( $ response -> responseCode != 200 ) { throw new Error ( "Server returned unexpected status code - {$response->responseCode} - {$response->body}" ) ; } return self :: parseJSONResponse ( $ response ) ; }
Get JSON as associative array from specified URL

@param string $url URL of the JSON

@return array Associative array that represents JSON object

@throws Error
Get JSON as associative array from specified URL