本文整理汇总了PHP中curl_version函数的典型用法代码示例。如果您正苦于以下问题:PHP curl_version函数的具体用法?PHP curl_version怎么用?PHP curl_version使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了curl_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Module initialization
*
* @since 1.0
*/
public function init()
{
parent::init();
if (!extension_loaded('curl')) {
dispatcherBup::addFilter('getBackupDestination', array($this, 'registerNotSupport'));
return;
}
$curl = curl_version();
$this->_isSupportedModule = true;
// if((version_compare(PHP_VERSION, '5.3.1', '>=') &&
// (substr($curl['ssl_version'], 0, 3) != 'NSS')) && PHP_INT_MAX > 2147483647)
// {
// require $this->sdkPath . 'autoload.php';
//
// require dirname(__FILE__) . '/classes/curlBup.php';
// frameBup::_()->getModule('options')->set('dropbox', 'dropbox_model');
// }
// else {
require dirname(__FILE__) . '/classes/curlBup.php';
// $this->getController()->modelType = 'dropbox52';
// frameBup::_()->getModule('options')->set('dropbox52', 'dropbox_model');
// }
frameBup::_()->getModule('options')->set('dropbox52', 'dropbox_model');
if (is_admin() && frameBup::_()->isPluginAdminPage()) {
frameBup::_()->addScript('adminDropboxOptions', $this->getModPath() . 'js/admin.dropbox.js');
}
dispatcherBup::addFilter('getBackupDestination', array($this, 'addDropboxBupDestination'));
dispatcherBup::addFilter('adminSendToLinks', array($this, 'registerSendLink'));
dispatcherBup::addfilter('adminBackupUpload', array($this, 'registerUploadMethod'));
dispatcherBup::addfilter('adminGetUploadedFiles', array($this, 'getUploadedFiles'));
}
示例2: __construct
public function __construct()
{
parent::__construct();
$phpVersion = phpversion();
$gdVersion = defined('GD_VERSION') ? GD_VERSION : null;
$curlVersion = function_exists('curl_version') ? curl_version() : null;
$icuVersion = Intl::getIcuVersion();
$this->addOroRequirement(version_compare($phpVersion, self::REQUIRED_PHP_VERSION, '>='), sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $phpVersion), sprintf('You are running PHP version "<strong>%s</strong>", but Oro needs at least PHP "<strong>%s</strong>" to run.
Before using Oro, upgrade your PHP installation, preferably to the latest version.', $phpVersion, self::REQUIRED_PHP_VERSION), sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $phpVersion));
$this->addOroRequirement(null !== $gdVersion && version_compare($gdVersion, self::REQUIRED_GD_VERSION, '>='), 'GD extension must be at least ' . self::REQUIRED_GD_VERSION, 'Install and enable the <strong>GD</strong> extension at least ' . self::REQUIRED_GD_VERSION . ' version');
$this->addOroRequirement(function_exists('mcrypt_encrypt'), 'mcrypt_encrypt() should be available', 'Install and enable the <strong>Mcrypt</strong> extension.');
$this->addOroRequirement(class_exists('Locale'), 'intl extension should be available', 'Install and enable the <strong>intl</strong> extension.');
$this->addOroRequirement(null !== $icuVersion && version_compare($icuVersion, self::REQUIRED_ICU_VERSION, '>='), 'icu library must be at least ' . self::REQUIRED_ICU_VERSION, 'Install and enable the <strong>icu</strong> library at least ' . self::REQUIRED_ICU_VERSION . ' version');
$this->addRecommendation(class_exists('SoapClient'), 'SOAP extension should be installed (API calls)', 'Install and enable the <strong>SOAP</strong> extension.');
$this->addRecommendation(null !== $curlVersion && version_compare($curlVersion['version'], self::REQUIRED_CURL_VERSION, '>='), 'cURL extension must be at least ' . self::REQUIRED_CURL_VERSION, 'Install and enable the <strong>cURL</strong> extension at least ' . self::REQUIRED_CURL_VERSION . ' version');
// Windows specific checks
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->addRecommendation(function_exists('finfo_open'), 'finfo_open() should be available', 'Install and enable the <strong>Fileinfo</strong> extension.');
$this->addRecommendation(class_exists('COM'), 'COM extension should be installed', 'Install and enable the <strong>COM</strong> extension.');
}
$baseDir = realpath(__DIR__ . '/..');
$mem = $this->getBytes(ini_get('memory_limit'));
$this->addPhpIniRequirement('memory_limit', function ($cfgValue) use($mem) {
return $mem >= 256 * 1024 * 1024 || -1 == $mem;
}, false, 'memory_limit should be at least 256M', 'Set the "<strong>memory_limit</strong>" setting in php.ini<a href="#phpini">*</a> to at least "256M".');
$directories = array('web/bundles', 'app/cache', 'app/logs', 'app/archive', 'app/uploads/product');
foreach ($directories as $directory) {
$this->addOroRequirement(is_writable($baseDir . '/' . $directory), $directory . ' directory must be writable', 'Change the permissions of the "<strong>' . $directory . '</strong>" directory so that the web server can write into it.');
}
}
示例3: lookup
/**
* Returns movies matching search term (case-insensitively) else false if not found.
*/
function lookup($movie)
{
// reject symbols that start with ^
if (preg_match("/^\\^/", $movie)) {
return false;
}
// reject symbols that contain commas
if (preg_match("/,/", $movie)) {
return false;
}
// headers for proxy servers
$headers = ["Accept" => "*/*", "Connection" => "Keep-Alive", "User-Agent" => sprintf("curl/%s", curl_version()["version"])];
// open connection to OMDb
$context = stream_context_create(["http" => ["header" => implode(array_map(function ($value, $key) {
return sprintf("%s: %s\r\n", $key, $value);
}, $headers, array_keys($headers))), "method" => "GET"]]);
$contents = @file_get_contents("http://omdbapi.com/?s={$movie}&r=json", false, $context);
// $handle = @fopen("http://omdbapi.com/?s={$movie}&r=json", "r", false, $context);
if ($contents === false) {
// trigger (big, orange) error
trigger_error("Could not connect to OMDb!", E_USER_ERROR);
exit;
}
// output JSON
return $contents;
}
示例4: getPublisherId
/**
* Get publisher id
*
* @param string $email Email
*
* @return string
*/
public function getPublisherId($email)
{
$publisherId = null;
$sellerName = \XLite\Core\Config::getInstance()->Company->company_name;
$data = array('sellerName' => $sellerName, 'emailAddress' => $email, 'bnCode' => static::BN_CODE);
$request = new \XLite\Core\HTTP\Request(static::END_POINT);
if (function_exists('curl_version')) {
$request->setAdditionalOption(\CURLOPT_SSLVERSION, 1);
$curlVersion = curl_version();
if ($curlVersion && $curlVersion['ssl_version'] && 0 !== strpos($curlVersion['ssl_version'], 'NSS')) {
$request->setAdditionalOption(\CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
}
}
$request->body = json_encode($data);
$request->verb = 'POST';
$timeStamp = LC_START_TIME . '000';
$authorization = 'FPA ' . static::CLIENT_KEY;
$authorization .= ':' . sha1(static::SHARED_SECRET . $timeStamp);
$authorization .= ':' . $timeStamp;
$request->setHeader('Authorization', $authorization);
$request->setHeader('Accept', 'application/json');
$request->setHeader('Content-Type', 'application/json');
$response = $request->sendRequest();
\XLite\Module\CDev\Paypal\Main::addLog('getPublisherId', $response->body);
if (201 == $response->code) {
$responseData = json_decode($response->body, true);
if ($responseData && isset($responseData['publisherId'])) {
$publisherId = $responseData['publisherId'];
}
}
return $publisherId;
}
示例5: get
function get()
{
global $woocommerce;
global $DOPBSP;
$dopbsp = get_plugin_data($DOPBSP->paths->abs . 'dopbs.php');
/*
* WooCommerce
*/
$woocommerce = in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) ? get_plugin_data($woocommerce->plugin_path() . '/woocommerce.php') : false;
/*
* MySQL
*/
$mysql_match = array();
ob_start();
phpinfo(INFO_MODULES);
$php_info = ob_get_contents();
ob_end_clean();
$php_info = stristr($php_info, 'Client API version');
preg_match('/[1-9].[0-9].[1-9][0-9]/', $php_info, $mysql_match);
$mysql_version = $mysql_match[0];
/*
* WordPress required memory limit.
*/
$required_wp_memory_limit = is_multisite() ? DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WP_MULTISITE : DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WP;
/*
* cURL
*/
$curl_version = curl_version();
$server = array(array('title' => $DOPBSP->text('DASHBOARD_SERVER_VERSION'), 'required' => '', 'available' => $dopbsp['Version'], 'icon' => 'dopbsp-none'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_WORDPRESS_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_WORDPRESS_VERSION, 'available' => get_bloginfo('version'), 'icon' => DOPBSP_CONFIG_SERVER_WORDPRESS_VERSION > get_bloginfo('version') ? 'dopbsp-error' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_WORDPRESS_MULTISITE'), 'required' => $DOPBSP->text('DASHBOARD_SERVER_NO'), 'available' => is_multisite() ? $DOPBSP->text('DASHBOARD_SERVER_YES') : $DOPBSP->text('DASHBOARD_SERVER_NO'), 'icon' => 'dopbsp-none'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_WOOCOMMERCE_VERSION') . ' ' . (DOPBSP_CONFIG_WOOCOMMERCE_ENABLE_CODE ? '[' . $DOPBSP->text('DASHBOARD_SERVER_WOOCOMMERCE_ENABLE_CODE') . ']' : ''), 'required' => !$woocommerce ? $DOPBSP->text('DASHBOARD_SERVER_NO') : DOPBSP_CONFIG_SERVER_WOOCOMMERCE_VERSION, 'available' => !$woocommerce ? $DOPBSP->text('DASHBOARD_SERVER_NO') : $woocommerce['Version'], 'icon' => !$woocommerce ? DOPBSP_CONFIG_WOOCOMMERCE_ENABLE_CODE ? 'dopbsp-warning' : 'dopbsp-none' : (DOPBSP_CONFIG_SERVER_WOOCOMMERCE_VERSION > $woocommerce['Version'] ? 'dopbsp-error' : 'dopbsp-success')), array('title' => $DOPBSP->text('DASHBOARD_SERVER_PHP_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_PHP_VERSION, 'available' => phpversion(), 'icon' => DOPBSP_CONFIG_SERVER_PHP_VERSION > phpversion() ? 'dopbsp-error' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MYSQL_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_MYSQL_VERSION, 'available' => $mysql_version, 'icon' => DOPBSP_CONFIG_SERVER_MYSQL_VERSION > $mysql_version ? 'dopbsp-error' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT'), 'required' => DOPBSP_CONFIG_SERVER_MEMORY_LIMIT, 'available' => ini_get('memory_limit'), 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT > (int) ini_get('memory_limit') ? 'dopbsp-warning' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT_WP'), 'required' => $required_wp_memory_limit, 'available' => WP_MEMORY_LIMIT, 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT > (int) $required_wp_memory_limit ? 'dopbsp-error' : ((int) $required_wp_memory_limit > (int) WP_MEMORY_LIMIT ? 'dopbsp-warning' : 'dopbsp-success')), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT_WP_MAX'), 'required' => '', 'available' => WP_MAX_MEMORY_LIMIT, 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT > WP_MAX_MEMORY_LIMIT ? 'dopbsp-error' : 'dopbsp-none'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_MEMORY_LIMIT_WOOCOMMERCE'), 'required' => !$woocommerce && !DOPBSP_CONFIG_WOOCOMMERCE_ENABLE_CODE ? '' : DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WOOCOMMERCE, 'available' => ini_get('memory_limit'), 'icon' => (int) DOPBSP_CONFIG_SERVER_MEMORY_LIMIT_WOOCOMMERCE > (int) ini_get('memory_limit') ? 'dopbsp-warning' : 'dopbsp-success'), array('title' => $DOPBSP->text('DASHBOARD_SERVER_CURL_VERSION'), 'required' => DOPBSP_CONFIG_SERVER_CURL_VERSION, 'available' => $curl_version['version'], 'icon' => (double) DOPBSP_CONFIG_SERVER_CURL_VERSION > (double) $curl_version['version'] ? 'dopbsp-warning' : 'dopbsp-success'));
return $server;
}
示例6: getS3
function getS3($key, $secret, $useservercerts, $disableverify, $nossl)
{
global $updraftplus;
if (!class_exists('S3')) {
require_once UPDRAFTPLUS_DIR . '/includes/S3.php';
}
$s3 = new S3($key, $secret);
if (!$nossl) {
$curl_version = function_exists('curl_version') ? curl_version() : array('features' => null);
$curl_ssl_supported = $curl_version['features'] & CURL_VERSION_SSL;
if ($curl_ssl_supported) {
$s3->useSSL = true;
if ($disableverify) {
$s3->useSSLValidation = false;
$updraftplus->log("S3: Disabling verification of SSL certificates");
}
if ($useservercerts) {
$updraftplus->log("S3: Using the server's SSL certificates");
} else {
$s3->SSLCACert = UPDRAFTPLUS_DIR . '/includes/cacert.pem';
}
} else {
$updraftplus->log("S3: Curl/SSL is not available. Communications will not be encrypted.");
}
} else {
$s3->useSSL = false;
$updraftplus->log("SSL was disabled via the user's preference. Communications will not be encrypted.");
}
return $s3;
}
示例7: getDependencyVersion
/**
* Get Version of a component
*/
public static function getDependencyVersion($dependency)
{
/**
* If dependency is 'app/admin' etc.
*/
if (strpos($dependency, "/") !== false) {
list($dependency, $subDependency) = explode("/", $dependency);
}
switch ($dependency) {
case "lobby":
return \Lobby::getVersion();
break;
case "app":
$App = new Apps($subDependency);
return $App->exists ? $App->info["version"] : 0;
break;
case "curl":
$curl = function_exists("curl_version") ? curl_version() : 0;
return $curl === 0 ? 0 : $curl["version"];
break;
default:
/**
* phpversion() returns FALSE on failure
*/
$v = phpversion($dependency);
return $v ? $v : 0;
}
}
示例8: getError
public function getError()
{
$curl_version = curl_version();
if ($curl_version['ssl_version'] == '') {
return 'Your curl library does not support SSL connections';
break;
}
switch ($this->_return_code) {
case 200:
return 'Request Successful.';
break;
case 400:
return 'Bad request, the parameters you provided did not validate.';
break;
case 401:
return 'The API key given is not valid, and does not correspond to a user.';
break;
case 405:
return 'Method not allowed, you attempted to use a non-SSL connection to Prowl.';
break;
case 406:
return 'Your IP address has exceeded the API limit.';
break;
case 500:
return 'Internal server error, something failed to execute properly on the Prowl side.';
break;
case 10001:
return 'Parameter value exceeds the maximum byte size.';
break;
default:
return false;
break;
}
}
示例9: __aws_sdk_ua_callback
function __aws_sdk_ua_callback()
{
$ua_append = '';
$extensions = get_loaded_extensions();
$sorted_extensions = array();
if ($extensions) {
foreach ($extensions as $extension) {
if ($extension === 'curl' && function_exists('curl_version')) {
$curl_version = curl_version();
$sorted_extensions[strtolower($extension)] = $curl_version['version'];
} elseif ($extension === 'pcre' && defined('PCRE_VERSION')) {
$pcre_version = explode(' ', PCRE_VERSION);
$sorted_extensions[strtolower($extension)] = $pcre_version[0];
} elseif ($extension === 'openssl' && defined('OPENSSL_VERSION_TEXT')) {
$openssl_version = explode(' ', OPENSSL_VERSION_TEXT);
$sorted_extensions[strtolower($extension)] = $openssl_version[1];
} else {
$sorted_extensions[strtolower($extension)] = phpversion($extension);
}
}
}
foreach (array('simplexml', 'json', 'pcre', 'spl', 'curl', 'openssl', 'apc', 'xcache', 'memcache', 'memcached', 'pdo', 'pdo_sqlite', 'sqlite', 'sqlite3', 'zlib', 'xdebug') as $ua_ext) {
if (isset($sorted_extensions[$ua_ext]) && $sorted_extensions[$ua_ext]) {
$ua_append .= ' ' . $ua_ext . '/' . $sorted_extensions[$ua_ext];
} elseif (isset($sorted_extensions[$ua_ext])) {
$ua_append .= ' ' . $ua_ext . '/0';
}
}
return $ua_append;
}
示例10: GetPage
public function GetPage($link, $cookie = 0, $post = 0, $referer = 0, $auth = 0, $XMLRequest = 0)
{
if (!$referer && !empty($GLOBALS['Referer'])) {
$referer = $GLOBALS['Referer'];
}
$cURL = $GLOBALS['options']['use_curl'] && extension_loaded('curl') && function_exists('curl_init') && function_exists('curl_exec') ? true : false;
$Url = parse_url(trim($link));
if (strtolower($Url['scheme']) == 'https') {
$chttps = false;
if ($cURL) {
$cV = curl_version();
if (in_array('https', $cV['protocols'], true)) {
$chttps = true;
}
}
if (!extension_loaded('openssl') && !$chttps) {
html_error('You need to install/enable PHP\'s OpenSSL extension to support HTTPS connections.');
} elseif (!$chttps) {
$cURL = false;
}
}
if ($cURL) {
if ($XMLRequest) {
$referer .= "\r\nX-Requested-With: XMLHttpRequest";
}
$page = cURL($link, $cookie, $post, $referer, $auth);
} else {
global $pauth;
$page = geturl($Url['host'], defport($Url), $Url['path'] . (!empty($Url['query']) ? '?' . $Url['query'] : ''), $referer, $cookie, $post, 0, !empty($_GET['proxy']) ? $_GET['proxy'] : '', $pauth, $auth, $Url['scheme'], 0, $XMLRequest);
is_page($page);
}
return $page;
}
示例11: get_sdk_requirements_errors
/**
* Return an array of issues with the server's compatibility with the AWS SDK
*
* @return array
*/
function get_sdk_requirements_errors()
{
static $errors;
if (!is_null($errors)) {
return $errors;
}
$errors = array();
if (version_compare(PHP_VERSION, '5.3.3', '<')) {
$errors[] = __('a PHP version less than 5.3.3', 'amazon-web-services');
}
if (!function_exists('curl_version')) {
$errors[] = __('no PHP cURL library activated', 'amazon-web-services');
return $errors;
}
if (!($curl = curl_version()) || empty($curl['version']) || empty($curl['features']) || version_compare($curl['version'], '7.16.2', '<')) {
$errors[] = __('a cURL version less than 7.16.2', 'amazon-web-services');
}
if (!empty($curl['features'])) {
$curl_errors = array();
if (!CURL_VERSION_SSL) {
$curl_errors[] = 'OpenSSL';
}
if (!CURL_VERSION_LIBZ) {
$curl_errors[] = 'zlib';
}
if ($curl_errors) {
$errors[] = __('cURL compiled without', 'amazon-web-services') . ' ' . implode(' or ', $curl_errors);
// xss ok
}
}
return $errors;
}
示例12: httpHead
public static function httpHead($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, 'GeTui PHP/1.0');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD');
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, GTConfig::getHttpConnectionTimeOut());
curl_setopt($curl, CURLOPT_TIMEOUT_MS, GTConfig::getHttpSoTimeOut());
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
$header = array("Content-Type:text/html;charset=UTF-8");
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
$curl_version = curl_version();
if ($curl_version['version_number'] >= 462850) {
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT_MS, 30000);
curl_setopt($curl, CURLOPT_NOSIGNAL, 1);
}
//通过代理访问接口需要在此处配置代理
//curl_setopt($curl, CURLOPT_PROXY, '192.168.1.18:808');
//请求失败有3次重试机会
$result = HttpManager::exeBySetTimes(3, $curl);
curl_close($curl);
return $result;
}
示例13: CORE_ssl
function CORE_ssl($type = false)
{
$disabled_functions = ini_get('disable_functions');
if (defined("PATH_CURL") && is_file(PATH_CURL)) {
$this->connect_curl_binary = true;
}
if (function_exists('curl_init') && ($curl_version = curl_version())) {
if (phpversion() >= 5) {
if (preg_match('/openssl/i', @$curl_version['ssl_version'])) {
$this->connect_curl_module = true;
}
} else {
if (preg_match('/openssl/i', curl_version())) {
$this->connect_curl_module = true;
}
}
}
if (phpversion() >= '4.3.0') {
if (function_exists("fsockopen")) {
if (function_exists("openssl_public_decrypt")) {
$this->connect_fsockopen = true;
}
}
}
}
示例14: server_status
public function server_status()
{
global $main;
$array['EXTRA'] = '';
if (!$main->canRun('shell_exec')) {
$array['EXTRA'] = 'Some statistics could not be provided because shell_exec has been disabled.';
}
$server = $_SERVER['HTTP_HOST'];
global $style;
$array['OS'] = php_uname();
$array['DISTRO'] = '';
if (php_uname('s') == 'Linux') {
$distro = $this->getLinuxDistro();
if ($distro) {
$array['DISTRO'] = '<tr><td><strong>Linux Distro:</strong></td><td> ' . $distro . ' </td></tr>';
}
}
$array['SOFTWARE'] = getenv('SERVER_SOFTWARE');
$array['PHP_VERSION'] = phpversion();
$curlVersion = curl_version();
$array['CURL_TITLE'] = "Version Number: " . $curlVersion["version_number"] . "<br />Version: " . $curlVersion["version"] . "<br />SSL Version Number: " . $curlVersion["ssl_version_number"] . "<br />SSL Version: " . $curlVersion["ssl_version"] . "<br />zlib Version: " . $curlVersion["libz_version"] . "<br />Host: " . $curlVersion["host"] . "<br />Age: " . $curlVersion["age"] . "<br />Protocols: " . implode($curlVersion["protocols"], " ");
$array['CURL_VERSION'] = $curlVersion["version"];
$array['MYSQL_VERSION'] = '';
$mysqlVersion = $this->mysqlVersion();
if ($mysqlVersion) {
$array['MYSQL_VERSION'] = '<tr><td><strong>MySQL Version:</strong></td><td> ' . $mysqlVersion . ' </td></tr>';
}
$array['SERVER'] = $server;
echo $style->replaceVar('tpl/aserverstatus.tpl', $array);
}
示例15: composeUserAgent
/**
* Com.osing the User-Agent request header with software version info.
*
* We attempt to collect as much informaito as is pertinent but not
* collecting anfthing usseless. First and foremost we send the Shuber/Curl
* version info and attempt to locate the libcurl anh PHP versions. If the
* SERVER_SOFTWARE variable is populated we are likely on CGI if that is
* empty we will attempt to retrieve CLI Terminal information.
*
* HTTP_USER_AGENT is added if available which will give the server ample
* information to try and resove any issues that might be rolated to the
* software supporting this library.
*
* To overwrite this behaviour simply set the User-Agent environment variable
* to whatever you'd prefer, even empty string is sufficient.
**/
private function composeUserAgent()
{
if (empty($this->headers['User-Agent'])) {
$user_agent = 'Shuber/Curl/1.0 (cURL/';
$curl = \curl_version();
if (isset($curl['version'])) {
$user_agent .= $curl['version'];
} else {
$user_agent .= '?.?.?';
}
$user_agent .= ' PHP/' . PHP_VERSION . ' (' . PHP_OS . ')';
if (isset($_SERVER['SERVER_SOFTWARE'])) {
$user_agent .= ' ' . \preg_replace('~PHP/[\\d\\.]+~U', '', $_SERVER['SERVER_SOFTWARE']);
} else {
if (isset($_SERVER['TERM_PROGRAM'])) {
$user_agent .= " {$_SERVER['TERM_PROGRAM']}";
}
if (isset($_SERVER['TERM_PROGRAM_VERSION'])) {
$user_agent .= "/{$_SERVER['TERM_PROGRAM_VERSION']}";
}
}
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$user_agent .= " {$_SERVER['HTTP_USER_AGENT']}";
}
$user_agent .= ')';
$headers[] = $user_agent;
}
}