Hi, I need some help please I have batch file that call my php script…this php script is listening to connected socket…and i want to pass a parameter on it.but i am confuse how to do i send the parameter which is from the web…
example if i pressed sendcommand button in my web this parameter will send to the connected socket.
$command = $_POST['comparam'];
//$command - here i don't know what to do with the $command i don't know how to send this to my running batch file so that this will be send to the //client connected in the socket.
I have this script already in my socket(this the running batch file)
If you are invoking PHP from the command line there will be no $_POST, $_GET, $_SESSION, $_REQUEST or $_COOKIE superglobals - these are set by the webserver. $_SERVER[‘argc’] will contain the arguments passed to the script from the command line.
A MySQL DB could serve as simple message queue. Your admin script would add a row to the table with the command to be executed and a timestamp. Your socket script would check the table at regular intervals for new entries and, if it finds one, executes the command. Check out the wikipedia entry for more info on message queues.
Your socket server is continuously running, listening for connections from your GPS device, right? So you can connect to it via a socket, and send it the commands that you want relayed to the device.