本文整理汇总了PHP中PhpBrew\Config::getProxyConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getProxyConfig方法的具体用法?PHP Config::getProxyConfig怎么用?PHP Config::getProxyConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpBrew\Config
的用法示例。
在下文中一共展示了Config::getProxyConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: knownReleases
public function knownReleases(Provider $provider)
{
$url = $provider->buildKnownReleasesUrl();
if (extension_loaded('curl')) {
$curlVersionInfo = curl_version();
$curlOptions = array(CURLOPT_USERAGENT => 'curl/' . $curlVersionInfo['version']);
$downloader = new CurlDownloader();
/*
FIXME
$console = Console::getInstance();
if (! $console->options->{'no-progress'}) {
$downloader->setProgressHandler(new ProgressBar);
}
*/
if ($this->options) {
if ($proxy = $this->options->{'http-proxy'}) {
$downloader->setProxy($proxy);
}
if ($proxyAuth = $this->options->{'http-proxy-auth'}) {
$downloader->setProxyAuth($proxyAuth);
}
}
$info = $downloader->request($url, array(), $curlOptions);
} else {
$proxyOptions = Config::getProxyConfig();
if ($proxyOptions) {
$context = stream_context_create(array($proxyOptions));
$info = file_get_contents($url, false, $context);
} else {
$info = file_get_contents($url);
}
}
return $provider->parseKnownReleasesResponse($info);
}
示例2: downloadReleaseListFromOfficialSite
private static function downloadReleaseListFromOfficialSite($version, OptionResult $options = null)
{
if (!extension_loaded('openssl')) {
throw new Exception('openssl extension not found, to download releases file you need openssl.');
}
$max = $options && $options->old ? 1000 : 100;
$url = "https://secure.php.net/releases/index.php?json&version={$version}&max={$max}";
if (extension_loaded('curl')) {
$downloader = new CurlDownloader();
$downloader->setProgressHandler(new ProgressBar());
if (!Console::getInstance()->options->{'no-progress'}) {
$downloader->setProgressHandler(new ProgressBar());
}
if ($options) {
$seconds = $options->{'connect-timeout'};
if ($seconds || ($seconds = getenv('CONNECT_TIMEOUT'))) {
$downloader->setConnectionTimeout($seconds);
}
if ($proxy = $options->{'http-proxy'}) {
$downloader->setProxy($proxy);
}
if ($proxyAuth = $options->{'http-proxy-auth'}) {
$downloader->setProxyAuth($proxyAuth);
}
}
$json = $downloader->request($url);
} else {
$proxyOptions = Config::getProxyConfig();
if ($proxyOptions) {
$context = steam_context_create($proxyOptions);
$json = file_get_contents($url, false, $context);
} else {
$json = file_get_contents($url);
}
}
$obj = json_decode($json, true);
return $obj;
}