PHP Classes

local machine Serial COM Port

Recommend this page to a friend!

      PHP Serial  >  All threads  >  local machine Serial COM Port  >  (Un) Subscribe thread alerts  
Subject:local machine Serial COM Port
Summary:PC serial port
Messages:2
Author:gilbertlow
Date:2011-09-18 10:29:55
Update:2011-10-09 19:56:55
 

  1. local machine Serial COM Port   Reply   Report abuse  
Picture of gilbertlow gilbertlow - 2011-09-18 10:29:55
Hi everyone,

Can i use php serial to read/write to local machine (PC) serial com port instead of web server serial com port ?
If it can be achieve, please help and provide some sample coding.
Thanks
Regards
Gilbert
gilbertlow@hotmail.com

  2. Re: local machine Serial COM Port   Reply   Report abuse  
Picture of atanas markov atanas markov - 2011-10-09 19:56:55 - In reply to message 1 from gilbertlow
You can't write to local port with php on server. If you need to do it install a local server on client machine(wamp for example) and call a script at http://localhost/... that does serial comunication. For example you can call sth. like:
$('#somediv').load('http://localhost/serialwrite.php?data=dfkkdfk');
and in the local serialwrite.php you can use phpSerial as you would on server(I use this scenario in a web based ERP application for printing cash receipts, reading scales, printing labels and so on on client machines, but in a more complicated way.). But remember that PHP just can't normally read com ports on Windows systems, so you may need a pecl extension if clients don't run on Linux/OSX.