src/ApiCall.php
protected function curl($type, $endpoint, $variables)
    {
        $url = $this->baseUrl . '/' . $endpoint;
        $handle = curl_init();
        curl_setopt($handle, CURLOPT_POST, true);
        //curl_setopt($handle, CURLOPT_COOKIE, TEST_COOKIE);
        $fieldsString = "";
        foreach ($variables as $key=>$value) {
            $fieldsString .= $key.'='.$value.'&';
        }
        $fieldsString = rtrim($fieldsString, '&');
        curl_setopt($handle, CURLOPT_POSTFIELDS, $fieldsString);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($handle, CURLOPT_URL, $url);
        $response = curl_exec($handle);
        $statusCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
        return array('statusCode'=>$statusCode, 'response'=>$response);
    }
protected function curl($type, $endpoint, $variables)
    {
        $url = $this->baseUrl . '/' . $endpoint;
        $handle = curl_init();
        curl_setopt($handle, CURLOPT_POST, true);
        //curl_setopt($handle, CURLOPT_COOKIE, TEST_COOKIE);
        $fieldsString = "";
        foreach ($variables as $key=>$value) {
            $fieldsString .= $key.'='.$value.'&';
        }
        $fieldsString = rtrim($fieldsString, '&');
        curl_setopt($handle, CURLOPT_POSTFIELDS, $fieldsString);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($handle, CURLOPT_URL, $url);
        $response = curl_exec($handle);
        $statusCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
        return array('statusCode'=>$statusCode, 'response'=>$response);
    }
protected function curl ( $ type , $ endpoint , $ variables ) { $ url = $ this -> baseUrl . '/' . $ endpoint ; $ handle = curl_init ( ) ; curl_setopt ( $ handle , CURLOPT_POST , true ) ; //curl_setopt($handle, CURLOPT_COOKIE, TEST_COOKIE); $ fieldsString = "" ; foreach ( $ variables as $ key => $ value ) { $ fieldsString .= $ key . '=' . $ value . '&' ; } $ fieldsString = rtrim ( $ fieldsString , '&' ) ; curl_setopt ( $ handle , CURLOPT_POSTFIELDS , $ fieldsString ) ; curl_setopt ( $ handle , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ handle , CURLOPT_URL , $ url ) ; $ response = curl_exec ( $ handle ) ; $ statusCode = curl_getinfo ( $ handle , CURLINFO_HTTP_CODE ) ; return array ( 'statusCode' => $ statusCode , 'response' => $ response ) ; }
Curls the API with the desired request type.

@param string $type      - the type of curl request (DELETE, GET, POST, PUT)
@param string $endpoint  - the endpoint to hit
@param array  $variables - the variables to send

@return string - API response (status code and string)
Curls the API with the desired request type .