PHP - Allumage d'une position



$yourUserName = "admin";
$yourPassword = "yourpassword";
$positionName = "POSITION03";

$authInfo = "$yourUserName:$yourPassword";

$postdata = array('Position' => $positionName);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://xxx.pblsrv.com:1337/PBL_SwitchOnPosition/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Authorization: Basic ' . base64_encode($authInfo)));
$response = curl_exec($ch);
curl_close($ch);


PHP - Extinction d'une position



$yourUserName = "admin";
$yourPassword = "yourpassword";
$positionName = "POSITION03";

$authInfo = "$yourUserName:$yourPassword";

$postdata = array('Position' => $positionName);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://xxx.pblsrv.com:1337/PBL_SwitchOffPosition/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Authorization: Basic ' . base64_encode($authInfo)));
$response = curl_exec($ch);
curl_close($ch);