http://www.info.kmtronic.com/km-web-eight-relay-box.html
PHP code for STATUS Read WEB Relay board connected to IP: 192.168.1.199 PORT:80 USER: admin PASSWORD: admin
Create a new file. <?php $url = "http://192.168.1.199:80/status.xml"; $username = "admin"; $password = "admin"; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); //execute post $result = curl_exec($ch); print $result;
Save the file as web_8relay_status.php and run. ( $ php web_8relay_status.php )
Result: $ php web_8_relay_status.php 0 0 0 0 0 0 0 0 0
PHP code for CONTROL WEB Relay board connected to IP: 192.168.1.199 PORT:80 USER: admin PASSWORD: admin
COMMANDS: FF0801 // TURN ON Relay 8
Create a new file. <?php $url = "http://192.168.1.199:80/FF0101"; // TURN ON Relay 1 $username = "admin"; $password = "admin"; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); //execute post $result = curl_exec($ch); print $result; ?> Save the file as web_relay_1_on.php and run. ( $ php web_relay_1_on.php ) |