Page 1 of 1

sending data out the serial port

Posted: Sat May 06, 2006 5:24 am
by steverossco
Hi,
I am trying to send information (a simple string of data) from PC out the serial port to a GSM Module and waz wondering does anyone know where i could get code to do this or any tutorials.

Thanks
Stephen

Posted: Sat May 06, 2006 6:46 am
by timvw
For this you need PHP to interoperate with your operating system..

On linux it would be as simple as talking to /dev/ttySX...
For DOS you probably need to open COMX and talk in there..
For windows you'll probably want to implement your own php extension using the info at http://msdn.microsoft.com/library/defau ... serial.asp...

Posted: Sat May 06, 2006 7:19 am
by Chris Corbyn
timvw wrote:For this you need PHP to interoperate with your operating system..

On linux it would be as simple as talking to /dev/ttySX...
For DOS you probably need to open COMX and talk in there..
For windows you'll probably want to implement your own php extension using the info at http://msdn.microsoft.com/library/defau ... serial.asp...
I'm interested in this too.... can you just open a handle using fopen() or similar and then fwrite() and fread() from it?

The what about the privileges of the www user ("nobody" on my setups)? This is completely new ground for me.

Posted: Sat May 06, 2006 7:31 am
by timvw
d11wtq wrote: I'm interested in this too.... can you just open a handle using fopen() or similar and then fwrite() and fread() from it?
Yes.
d11wtq wrote: The what about the privileges of the www user ("nobody" on my setups)? This is completely new ground for me.
Well, you can consider the device as a 'file' in the filesystem. Thus all the access rules for accessing a file are also relevant for this particular 'file'.

More (much more) info at http://www.tldp.org/HOWTO/Serial-HOWTO.html ;)