/** * Constructor. * * @param string $sid Account SID * @param string $token Account auth token * @param string $version API version * @param Services_Twilio_Http $_http A HTTP client */ public function __construct($sid, $token, $version = '2010-04-01', Services_Twilio_TinyHttp $_http = null) { $this->version = $version; if (null === $_http) { $_http = new Services_Twilio_TinyHttp("https://api.twilio.com", array("curlopts" => array(CURLOPT_USERAGENT => self::USER_AGENT, CURLOPT_CAINFO => dirname(__FILE__) . "/twilio_ssl_certificate.crt"))); } $_http->authenticate($sid, $token); $this->http = $_http; $this->accounts = new Services_Twilio_Rest_Accounts($this); $this->account = $this->accounts->get($sid); }
/** * Constructor. * * @param string $sid Account SID * @param string $token Account auth token * @param string $version API version * @param Services_Twilio_Http $_http A HTTP client */ public function __construct($sid, $token, $version = null, Services_Twilio_TinyHttp $_http = null) { $this->version = in_array($version, $this->versions) ? $version : $this->versions[count($this->versions) - 1]; if (null === $_http) { $_http = new Services_Twilio_TinyHttp("https://api.twilio.com", array("curlopts" => array(CURLOPT_USERAGENT => self::USER_AGENT, CURLOPT_HTTPHEADER => array('Accept-Charset: utf-8'), CURLOPT_CAINFO => dirname(__FILE__) . "/twilio_ssl_certificate.crt"))); } $_http->authenticate($sid, $token); $this->http = $_http; $this->accounts = new Services_Twilio_Rest_Accounts($this); $this->account = $this->accounts->get($sid); }
/** * Constructor. * * @param string $sid Account SID * @param string $token Account auth token * @param string $version API version * @param Services_Twilio_Http $_http A HTTP client */ public function __construct($sid, $token, $version = 'v1', Services_Twilio_TinyHttp $_http = null) { $this->version = $version; if (null === $_http) { $_http = new Services_Twilio_TinyHttp("https://api.plivo.com", array("curlopts" => array(CURLOPT_USERAGENT => self::USER_AGENT))); } $_http->authenticate($sid, $token); $this->http = $_http; $this->accounts = new Services_Twilio_Rest_Accounts($this); $this->account = $this->accounts->get($sid); }
/** * Constructor. * * @param string $sid Account SID * @param string $token Account auth token * @param string $version API version * @param Services_Twilio_Http $_http A HTTP client */ public function __construct($sid, $token, $version = null, Services_Twilio_TinyHttp $_http = null) { $this->version = in_array($version, $this->versions) ? $version : end($this->versions); if (null === $_http) { if (!in_array('curl', get_loaded_extensions())) { trigger_error("It looks like you do not have curl installed.\n" . "Curl is required to make HTTP requests using the twilio-php\n" . "library. For install instructions, visit the following page:\n" . "http://php.net/manual/en/curl.installation.php", E_USER_WARNING); } $_http = new Services_Twilio_TinyHttp("https://api.twilio.com", array("curlopts" => array(CURLOPT_USERAGENT => self::USER_AGENT, CURLOPT_HTTPHEADER => array('Accept-Charset: utf-8'), CURLOPT_CAINFO => dirname(__FILE__) . "/twilio_ssl_certificate.crt"))); } $_http->authenticate($sid, $token); $this->http = $_http; $this->accounts = new Services_Twilio_Rest_Accounts($this, "/{$this->version}/Accounts"); $this->account = $this->accounts->get($sid); }