Need REALLY BIG BLF LIGHT for time conditions (or something I can control a light with)

Well, here’s the script:

<?php
$username="admin";
$password="supersecretpassword";
$phoneip = $_SERVER["REMOTE_ADDR"];

if (isset($_GET["dndstate"])) { $dndstate = $_GET["dndstate"]; }
// $dndstate = "on";

if ( $dndstate == "on" ) {
setWallpaper("PGBDND.png", $phoneip, $username, $password);
} else {
setWallpaper("PGBG02.png", $phoneip, $username, $password);
}

function setWallpaper($rname, $host, $username, $password) {
$ch = curl_init();

$xml_data = 'xml=<YealinkIPPhoneConfiguration Beep="yes" setType="config">' .
     '<Item>phone_setting.backgrounds = Config:'. $rname .'</Item>'.
            '</YealinkIPPhoneConfiguration>';

echo $xml_data;
// Login to the web interface
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_URL, 'http://'.$host.'/');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/dev/null');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POST, 1);

// Post Wallpaper Choice
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml_data");
$content = curl_exec($ch);

return $content;
}

?>

… to make this work, I had to program my Yealink phones with ActionURLs

1 Like