src/Service/CommandExecutor.php
public function send($command, $host = '')
    {
        $host = $host ?: $this->host;
        if (!$host) {
            throw new \InvalidArgumentException('Unknown host that will run the command');
        }
        $content = 'command='.urlencode($command);

        $fp = fsockopen($this->host, 80, $errno, $errstr, self::TIMEOUT);
        $request = 'POST '.$this->path." HTTP/1.1\r\n";
        $request .= 'Host: '.$host."\r\n";
        $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $request .= 'Content-Length: '.strlen($content)."\r\n";
        $request .= "Connection: Close\r\n\r\n";
        $request .= $content;
        fwrite($fp, $request);
        fclose($fp);
    }
public function send($command, $host = '')
    {
        $host = $host ?: $this->host;
        if (!$host) {
            throw new \InvalidArgumentException('Unknown host that will run the command');
        }
        $content = 'command='.urlencode($command);

        $fp = fsockopen($this->host, 80, $errno, $errstr, self::TIMEOUT);
        $request = 'POST '.$this->path." HTTP/1.1\r\n";
        $request .= 'Host: '.$host."\r\n";
        $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $request .= 'Content-Length: '.strlen($content)."\r\n";
        $request .= "Connection: Close\r\n\r\n";
        $request .= $content;
        fwrite($fp, $request);
        fclose($fp);
    }
public function send ( $ command , $ host = '' ) { $ host = $ host ? : $ this -> host ; if ( ! $ host ) { throw new \ InvalidArgumentException ( 'Unknown host that will run the command' ) ; } $ content = 'command=' . urlencode ( $ command ) ; $ fp = fsockopen ( $ this -> host , 80 , $ errno , $ errstr , self :: TIMEOUT ) ; $ request = 'POST ' . $ this -> path . " HTTP/1.1\r\n" ; $ request .= 'Host: ' . $ host . "\r\n" ; $ request .= "Content-Type: application/x-www-form-urlencoded\r\n" ; $ request .= 'Content-Length: ' . strlen ( $ content ) . "\r\n" ; $ request .= "Connection: Close\r\n\r\n" ; $ request .= $ content ; fwrite ( $ fp , $ request ) ; fclose ( $ fp ) ; }
Send the command to perform in a new thread.

@param string $command
@param string $host
Send the command to perform in a new thread .