mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-06-07 00:47:00 +03:00
added initial https support
This commit is contained in:
parent
b0c35bde5e
commit
0b97e09bb7
2 changed files with 16 additions and 8 deletions
|
@ -13,12 +13,17 @@ if (!is_csrf_safe()) {
|
|||
function api_request($path, $opts = null, $type = null) {
|
||||
global $apisid, $apiuser, $apipass, $apiip, $apiport, $authmethod;
|
||||
|
||||
$url = "http://$apiip:$apiport${path}";
|
||||
$url = "$apiproto://$apiip:$apiport${path}";
|
||||
|
||||
if ($authmethod == "auto") {
|
||||
$ad = curl_init();
|
||||
|
||||
if ( strcasecmp( $apiproto, 'https' ) == 0 ) {
|
||||
curl_setopt($ad, CURLOPT_SSL_VERIFYPEER, $apisslverify);
|
||||
}
|
||||
|
||||
curl_setopt($ad, CURLOPT_HTTPHEADER, array('X-API-Key: '.$apipass));
|
||||
curl_setopt($ad, CURLOPT_URL, "http://$apiip:$apiport/servers/localhost/statistics");
|
||||
curl_setopt($ad, CURLOPT_URL, "$apiproto://$apiip:$apiport/servers/localhost/statistics");
|
||||
curl_setopt($ad, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_exec($ad);
|
||||
if (curl_getinfo($ad, CURLINFO_HTTP_CODE) == 401) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue