The function that you want to implement is this:
Client PHP page, perform a task, such as a new site, in some way to notify the back end of the NC listener, and then execute the relevant script, instead of creating an FTP account, create a new directory and so on.
But how can I send a message to NC via PHP?
For advice
The following are the PHP clients:
$fp = fsockopen ("udp://127.0.0.1",40030,$errno,$errstr,30);if(!$fp){
";}else{ fwrite($fp,"Hello nc"); echo "Success"; fclose($fp);}
The following is the Shell service side:
#!/bin/bashkillall 'nc' >/dev/null 2>&1nc -l -u 40030 | while read Linedo echo $Linedone
But why not output it?
Reply content:
The function that you want to implement is this:
Client PHP page, perform a task, such as a new site, in some way to notify the back end of the NC listener, and then execute the relevant script, instead of creating an FTP account, create a new directory and so on.
But how can I send a message to NC via PHP?
For advice
The following are the PHP clients:
$fp = fsockopen ("udp://127.0.0.1",40030,$errno,$errstr,30);if(!$fp){
";}else{ fwrite($fp,"Hello nc"); echo "Success"; fclose($fp);}
The following is the Shell service side:
#!/bin/bashkillall 'nc' >/dev/null 2>&1nc -l -u 40030 | while read Linedo echo $Linedone
But why not output it?
Because bash's read command is read a line from the standard input and split it into fields.
So you need to output a line break:fwrite($fp,"Hello nc\n");
And why don't you use Popen to execute scripts directly in PHP, why superfluous use NC? You close the NC connection and close it off.
Back end why with NC, back end can also be written in PHP, such as the use of Workerman such a service framework
I don't know what you're doing. However, if you mention security, then either do not use UDP, or add your own authentication and integrity checks. Especially you use NC to deal with UDP, so that the message line is gone.