本文整理汇总了PHP中set_curl_proxy函数的典型用法代码示例。如果您正苦于以下问题:PHP set_curl_proxy函数的具体用法?PHP set_curl_proxy怎么用?PHP set_curl_proxy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_curl_proxy函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: version_info
/**
* Returns version info
* @return array
**/
function version_info($remote = true)
{
global $config;
$output = array();
if ($remote === true && $config['update_channel'] == 'master') {
$api = curl_init();
set_curl_proxy($api);
curl_setopt($api, CURLOPT_USERAGENT, 'LibreNMS');
curl_setopt($api, CURLOPT_URL, $config['github_api'] . 'commits/master');
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
$output['github'] = json_decode(curl_exec($api), true);
}
$output['local_sha'] = chop(`git rev-parse HEAD`);
$output['db_schema'] = dbFetchCell('SELECT version FROM dbSchema');
$output['php_ver'] = phpversion();
$output['mysql_ver'] = dbFetchCell('SELECT version()');
$output['rrdtool_ver'] = implode(' ', array_slice(explode(' ', shell_exec($config['rrdtool'] . ' --version |head -n1')), 1, 1));
$output['netsnmp_ver'] = shell_exec($config['snmpget'] . ' --version 2>&1');
return $output;
}
开发者ID:BillTheBest,项目名称:librenms,代码行数:24,代码来源:common.php
示例2: version_info
/**
* Returns version info
* @return array
**/
function version_info($remote = true)
{
global $config;
$output = array();
if ($remote === true && $config['update_channel'] == 'master') {
$api = curl_init();
set_curl_proxy($api);
curl_setopt($api, CURLOPT_USERAGENT, 'LibreNMS');
curl_setopt($api, CURLOPT_URL, $config['github_api'] . 'commits/master');
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
$output['github'] = json_decode(curl_exec($api), true);
}
list($local_sha, $local_date) = explode('|', rtrim(`git show --pretty='%H|%ct' -s HEAD`));
$output['local_sha'] = $local_sha;
$output['local_date'] = $local_date;
$output['local_branch'] = rtrim(`git rev-parse --abbrev-ref HEAD`);
$output['db_schema'] = dbFetchCell('SELECT version FROM dbSchema');
$output['php_ver'] = phpversion();
$output['mysql_ver'] = dbFetchCell('SELECT version()');
$output['rrdtool_ver'] = implode(' ', array_slice(explode(' ', shell_exec($config['rrdtool'] . ' --version |head -n1')), 1, 1));
$output['netsnmp_ver'] = str_replace('version: ', '', rtrim(shell_exec($config['snmpget'] . ' --version 2>&1')));
return $output;
}
开发者ID:arrmo,项目名称:librenms,代码行数:27,代码来源:common.php
示例3: location_to_latlng
function location_to_latlng($device)
{
global $config;
if (function_check('curl_version') !== true) {
d_echo("Curl support for PHP not enabled\n");
return false;
}
$bad_loc = false;
$device_location = $device['location'];
if (!empty($device_location)) {
$new_device_location = preg_replace("/ /", "+", $device_location);
// We have a location string for the device.
$loc = parse_location($device_location);
if (!is_array($loc)) {
$loc = dbFetchRow("SELECT `lat`,`lng` FROM `locations` WHERE `location`=? LIMIT 1", array($device_location));
}
if (is_array($loc) === false) {
// Grab data from which ever Geocode service we use.
switch ($config['geoloc']['engine']) {
case "google":
default:
d_echo("Google geocode engine being used\n");
$api_key = $config['geoloc']['api_key'];
if (!empty($api_key)) {
d_echo("Use Google API key: {$api_key}\n");
$api_url = "https://maps.googleapis.com/maps/api/geocode/json?address={$new_device_location}&key={$api_key}";
} else {
$api_url = "https://maps.googleapis.com/maps/api/geocode/json?address={$new_device_location}";
}
break;
}
$curl_init = curl_init($api_url);
set_curl_proxy($curl_init);
curl_setopt($curl_init, CURLOPT_RETURNTRANSFER, true);
$data = json_decode(curl_exec($curl_init), true);
// Parse the data from the specific Geocode services.
switch ($config['geoloc']['engine']) {
case "google":
default:
if ($data['status'] == 'OK') {
$loc = $data['results'][0]['geometry']['location'];
} else {
$bad_loc = true;
}
break;
}
if ($bad_loc === true) {
d_echo("Bad lat / lng received\n");
} else {
$loc['timestamp'] = array('NOW()');
$loc['location'] = $device_location;
if (dbInsert($loc, 'locations')) {
d_echo("Device lat/lng created\n");
} else {
d_echo("Device lat/lng could not be created\n");
}
}
} else {
d_echo("Using cached lat/lng from other device\n");
}
}
}
开发者ID:jcbailey2,项目名称:librenms,代码行数:62,代码来源:functions.inc.php
示例4: dbFetchRows
$data = dbFetchRows($query);
$response[$name] = $data;
}
$output = array('uuid' => $uuid, 'data' => $response);
$data = json_encode($output);
$submit = array('data' => $data);
$fields = '';
foreach ($submit as $key => $value) {
$fields .= $key . '=' . $value . '&';
}
rtrim($fields, '&');
$post = curl_init();
set_curl_proxy($post);
curl_setopt($post, CURLOPT_URL, $config['callback_post']);
curl_setopt($post, CURLOPT_POST, count($submit));
curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($post);
} elseif ($enabled == 2) {
$uuid = dbFetchCell("SELECT `value` FROM `callback` WHERE `name` = 'uuid'");
$fields = "uuid={$uuid}";
$clear = curl_init();
set_curl_proxy($clear);
curl_setopt($clear, CURLOPT_URL, $config['callback_clear']);
curl_setopt($clear, CURLOPT_POST, count($clear));
curl_setopt($clear, CURLOPT_POSTFIELDS, $fields);
curl_setopt($clear, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($clear);
dbDelete('callback', '`name`="uuid"', array());
dbUpdate(array('value' => '0'), 'callback', '`name` = "enabled"', array());
}
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:callback.php
注:本文中的set_curl_proxy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论