function __construct($clientid, $secret) { //Get oauth token to access Itero API $verbose = fopen('php://stderr', 'w'); $curl = curl_init(); $data = http_build_query(array('grant_type' => 'client_credentials')); curl_setopt_array($curl, array(CURLOPT_URL => self::$oAuth, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $data, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => "{$clientid}:{$secret}", CURLOPT_RETURNTRANSFER => true, CURLOPT_VERBOSE => true, CURLOPT_STDERR => $verbose)); $response = curl_exec($curl); $this->exit_on_error($curl); $token = json_decode($response); self::$auth = "Authorization: Bearer " . $token->access_token; }