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);
    }