当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::getProxyConfig方法代码示例

本文整理汇总了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);
 }
开发者ID:Keloran,项目名称:phpbrew,代码行数:35,代码来源:ExtensionDownloader.php

示例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;
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:38,代码来源:ReleaseList.php


注:本文中的PhpBrew\Config::getProxyConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。