當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。