Controle VM201 with PHP

This sample PHP script toggles relay 1 on the board and displays any data from the board.
Change the IP(10.0.0.112) and port(9760) to yours.
Authentication must be turned off for this script !!!

<?php
$fp = fsockopen("10.0.0.112", 9760, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
$hex = ("02065401A303");
    $string="";
    for ($i=0; $i < strlen($hex)-1; $i+=2)
    {
        $string .= chr(hexdec($hex[$i].$hex[$i+1]));
    }
    fwrite($fp, $string);
    sleep(1);
    echo fread($fp, 1024);
    fclose($fp);
}
?>

If you are not skilled with checksum calculations here is a small
Quick referents table in HEX

------- *** TOGGLE *** ***** ON ******** ***** OFF *******
Relay1 02065401A303 02064F01A803 02064601B103
Relay2 02065402A203 02064F02A703 02064602B003
Relay3 02065404A003 02064F04A503 02064604AE03
Relay4 020654089C03 02064F08A103 02064608AA03
Relay5 020654109403 02064F109903 02064610A203
Relay6 020654208403 02064F208903 020646209203
Relay7 020654406403 02064F406903 020646407203
Relay8 020654802403 02064F802903 020646803203

Thank you for sharing

It is very good script for me, thanks - kabelmanroel -
One question, how to get channel status in php, human readable format (0 or 1)??