probably you have got right. there is working code, I changed way to generate parameters to more clear version
public function request($url, $debug=false){
$options = array(
CURLOPT_URL => $this->url.$url,
CURLOPT_HEADER => false,
CURLOPT_VERBOSE => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_SSL_VERIFYPEER => false, // for https
CURLOPT_USERPWD => $this->login . ":" . $this->password,
CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
);
$ch = curl_init();
curl_setopt_array($ch, $options);
$raw_response = curl_exec($ch);
if($debug){
var_dump($raw_response);
die($this->url.$url);
}
return $raw_response;
}
public function addChannel($uuid,$name){
$url = '/api/channel/create?conf=';
$options = [
'enabled' => true,
'name' => $name,
'number' => '',
'services' => [$uuid],
'tags' => '',
'autoname' => true,
'icon' => '',
'epgauto' => true,
'epglimit' => 1,
'epggrab' => '',
'dvr_pre_time' => 0,
'dvr_pst_time' => 0,
'epg_running' => 0,
'epg_parent' => '',
];
$url .= urlencode(json_encode($options));
return $this->request($url);
}