Skip to content

Instantly share code, notes, and snippets.

@caseysoftware
Created June 18, 2013 15:30
Show Gist options
  • Select an option

  • Save caseysoftware/5806354 to your computer and use it in GitHub Desktop.

Select an option

Save caseysoftware/5806354 to your computer and use it in GitHub Desktop.
The cURL vs Streams fallback
if (in_array('curl', get_loaded_extensions())) {
$_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__) . '/cacert.pem',
))
);
} else {
$_http = new Services_Twilio_HttpStream(
"https://api.twilio.com",
array(
"http_options" => array(
"http" => array(
"user_agent" => self::USER_AGENT,
"header" => "Accept-Charset: utf-8\r\n",
),
"ssl" => array(
'verify_peer' => true,
'cafile' => dirname(__FILE__) . '/cacert.pem',
'verify_depth' => 5,
),
),
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment