src/UptimeRobot/API.php
public function request($resource, $args = array())
    {

        $url = $this->buildUrl($resource, $args);
        $curl = curl_init($url);

        curl_setopt_array($curl, $this->options);
        $this->contents = curl_exec($curl);
        $this->setDebug($curl);

        if (curl_errno($curl) > 0) {
            throw new \Exception('There was an error while making the request');
        }

        $jsonDecodeContent = json_decode($this->contents, true);

        if(is_null($jsonDecodeContent)) {
            throw new \Exception('Unable to decode JSON response');
        }

        return $jsonDecodeContent;
    }
public function request($resource, $args = array())
    {

        $url = $this->buildUrl($resource, $args);
        $curl = curl_init($url);

        curl_setopt_array($curl, $this->options);
        $this->contents = curl_exec($curl);
        $this->setDebug($curl);

        if (curl_errno($curl) > 0) {
            throw new \Exception('There was an error while making the request');
        }

        $jsonDecodeContent = json_decode($this->contents, true);

        if(is_null($jsonDecodeContent)) {
            throw new \Exception('Unable to decode JSON response');
        }

        return $jsonDecodeContent;
    }
public function request ( $ resource , $ args = array ( ) ) { $ url = $ this -> buildUrl ( $ resource , $ args ) ; $ curl = curl_init ( $ url ) ; curl_setopt_array ( $ curl , $ this -> options ) ; $ this -> contents = curl_exec ( $ curl ) ; $ this -> setDebug ( $ curl ) ; if ( curl_errno ( $ curl ) > 0 ) { throw new \ Exception ( 'There was an error while making the request' ) ; } $ jsonDecodeContent = json_decode ( $ this -> contents , true ) ; if ( is_null ( $ jsonDecodeContent ) ) { throw new \ Exception ( 'Unable to decode JSON response' ) ; } return $ jsonDecodeContent ; }
Makes curl call to the url & returns output.

@param string $resource The resource of the api
@param array $args Array of options for the query query

@return array json_decoded contents
@throws \Exception If the curl request fails
Makes curl call to the url & returns output .