33 lines
717 B
PHP
33 lines
717 B
PHP
<?php
|
|
// src/OgBootBundle/Service/CurlRequestService.php
|
|
|
|
namespace App\OgBootBundle\Service;
|
|
use Exception;
|
|
|
|
class CurlRequestService
|
|
{
|
|
|
|
public function convertMaskToCIDR($mask)
|
|
{
|
|
$bits = 0;
|
|
$mask = explode(".", $mask);
|
|
|
|
foreach ($mask as $octect)
|
|
$bits += strlen(str_replace("0", "", decbin($octect)));
|
|
|
|
return $bits;
|
|
}
|
|
|
|
public function callOgLive($parameter)
|
|
{
|
|
$ogLiveCliPath = sprintf("%s/bin/oglivecli", dirname(dirname(dirname(__DIR__))));
|
|
|
|
$command = sprintf("%s %s", $ogLiveCliPath, $parameter);
|
|
|
|
syslog(LOG_INFO, 'command '.$command);
|
|
$output = shell_exec($command);
|
|
|
|
return $output;
|
|
}
|
|
}
|