Beispiel #1
0
 public static function sendCommand($command)
 {
     if (self::$connection == null) {
         self::$connection = stream_socket_client("tcp://127.0.0.1:8989", $errno, $errorMessage);
         if (self::$connection === false) {
             throw new UnexpectedValueException("Failed to connect: {$errorMessage}");
         }
     }
     fwrite(self::$connection, $command);
 }