Send string to Xbee from PHP
eagletalontim
Posts: 1,399
I have been all over the web and cannot seem to find information on how to send a string to the XBee using PHP. I have tried fsockopen, socket_connect, telnet scripts and have had no luck connecting to my XBee with scripts. I can however connect using telnet on my PC. I use my home IP address and the port number set up in my router to forward requests to the XBee when connecting with either Telnet or attempts with PHP. When using telnet, it takes about a minute to actually connect and it usually happens when the Xbee is sending out data.
Is there some setting I need to make in the XBee to accept requests from my server? Do I need to remove the Destination IP and Destination Port settings from the XBee to get this to work? Those are both set to my remote server IP / open TCP/UDP port. The Xbee will properly connect to the socket server I have made on that port and can send data and receive data. I am actually hoping to remove the socket server and have the XBee communicate with my script as needed.
What the final result should be is my HTML form uses ajax to call a php script that will send a string to the XBee ( String : "Received:Command:3:END" ) and the XBee will transfer the data to the Prop and process accordingly.
Is there some setting I need to make in the XBee to accept requests from my server? Do I need to remove the Destination IP and Destination Port settings from the XBee to get this to work? Those are both set to my remote server IP / open TCP/UDP port. The Xbee will properly connect to the socket server I have made on that port and can send data and receive data. I am actually hoping to remove the socket server and have the XBee communicate with my script as needed.
What the final result should be is my HTML form uses ajax to call a php script that will send a string to the XBee ( String : "Received:Command:3:END" ) and the XBee will transfer the data to the Prop and process accordingly.