sending data out the serial port

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
steverossco
Forum Newbie
Posts: 4
Joined: Thu Apr 13, 2006 11:43 am

sending data out the serial port

Post 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
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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 ;)
Post Reply