Created
April 9, 2014 16:28
-
-
Save damiankloip/10289053 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get an array of default options to apply to the client | |
* | |
* @return array | |
*/ | |
protected function getDefaultOptions() | |
{ | |
$settings = [ | |
'allow_redirects' => true, | |
'exceptions' => true, | |
'verify' => __DIR__ . '/cacert.pem' | |
]; | |
// Use the bundled cacert if it is a regular file, or set to true if | |
// using a phar file (because curL and the stream wrapper can't read | |
// cacerts from the phar stream wrapper). Favor the ini setting over | |
// the system's cacert. | |
if (substr(__FILE__, 0, 7) == 'phar://') { | |
$settings['verify'] = ini_get('openssl.cafile') ?: true; | |
} | |
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set | |
if (isset($_SERVER['HTTP_PROXY'])) { | |
$settings['proxy']['http'] = $_SERVER['HTTP_PROXY']; | |
} | |
if (isset($_SERVER['HTTPS_PROXY'])) { | |
$settings['proxy']['https'] = $_SERVER['HTTPS_PROXY']; | |
} | |
return $settings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment