port = fopen("com6","w"); $isOpen = true; } public function getPort() { return $this->port; } public function isOpen() { return $this->isOpen; } public function __destruct() { fclose($this->port); $isOpen = false; } } // Format the command $command = $_GET["command"]; $finalCommand = $command; `mode COM6: BAUD=9600 PARITY=N data=8 stop=1 xon=off`; $fp = new Serial(); fwrite($fp->getPort(), $finalCommand); $buffer = fgets($fp->getPort(), 1024); echo "".$command." command sent"; ?>