I have running batch file as my socket listener that will receive data from connected client. I want to send command to the connected client through web page, but I am having problem or I have no idea on how to get this work, to pass the parameter to the my running batch file listener.
I tried this code snippet in sending command to client of my running batch file.
if(isset($_GET['comparam'])) {
$mycommand = $_GET['comparam'];
foreach ($clients as $send_sock) {
socket_write($send_sock, $mycommand);
}
}
but nothing happens, my code is not working.
I appreciate someone can help me on this problem.
You are running php from a bacth file so it is PHP CLI.
$_GET
is for the web version such notion does not exist in Command lines.
The way you would pass argument is like this:
C:\some\path\yourScript.php comparam
Then you would read the value from the script like the following:
if(isset($argv[1])){
$mycommand = $argv[1];
foreach ($clients as $send_sock) {
socket_write($send_sock, $mycommand);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.