animinimo Posted March 30, 2010 Share Posted March 30, 2010 Hi there, I'am trying to control a GPIO box via telnet commands over the internet. The hardware box came with a php script to read the outputs and set the inputs, this is only working for the outputs. I broke the script down to just a simple connect to the box with fsockopen function and now I am trying to send a hex message to it. I have a list of hex messages to set the input states. Still it is not working. The box itself has an windows application wich allows me to set all the parameters of it, so I know it is working properly with this ip and port. My php knowledge is fair, but I cant seem to figure out how to send the hexadecimal message...Probably I am doing something dumb or silly... If someone could take a peek at my script, that would be great. Thanks in advance! This is the script I use to connect to the box. I tried a couple different ways to create my hex message, so that's the command and tryout variables you see. The tryout variable you see typed in here is the hex code I want to send to the unit. $fp = fsockopen( "192.168.147.86", 23, $errno,$errdesc) or die("Connection to PP failed"); $command = Chr(255); $command .= Chr(250); $command .= Chr(44); $command .= Chr(50); $command .= Chr(0); $command .= Chr(255); $command .= Chr(240); $origineel = ''; $tryout = FFFA2C3440FFF0; fputs($fp, $tryout); echo $errno.$errdesc.'<br/>'; echo $tryout; fclose($fp); Quote Link to comment https://forums.phpfreaks.com/topic/196959-controlling-a-gpio-box-via-php/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.