fopen com1:

From: Date: Tue, 17 Aug 2004 10:09:11 +0000
Subject: fopen com1:
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969363256@lists.php.net to get a copy of this message
Hello all! Greatest respect for PHP, it just keeps performing where other languages let me down. Recently searched for a way to communicate on the serial port through PHP and found the example below from the fopen() manual page. |This is great stuff, obviously. But the com1: option to fopen does not appear anywhere in the documentation. Also, I'm wondering how Andrew set the mode on the serial port as he mentions in the comment! Any help or just a manual addition, much appreciated... Steve| *andrewra at NOSPAM dot webmail dot co dot za* 12-Jul-2004 03:32 |A simple little script to send SMS messages through a GSM phone connected to a serial communications port (win32). Tested on a Nokia 6310i: <?php $number="+123456789"; $message="Hello World"; $port="com1:"; if ($fh=fopen("com1:","w+")) { /* 'mode com1: BAUD=9600 PARITY=N data=8 stop=1 xon=off'; */ fputs($fh,"\rATZ\r"); sleep(1); fputs($fh,"AT+CMGF=1\r"); sleep(1); fputs($fh,"AT+CMGS=\"+{$number}\"\r"); sleep(1); fputs($fh,"{$message}\x1A\r"); fclose($fh); } else { echo "Failed to open port."; } ?> | -- _________________________________________________ * SEAMLESS DISTRIBUTION ***www.seamless.se* <mailto:steve.rapaport@seamless.sewww.seamless.se>* * - The electronic solution * ** ** *Steve Rapaport -- Key Account Manager *Dalagatan 100, 8 tr, 113 43 Stockholm Phone: +46 (0)8 564 878 00, Fax: +46 (0)8 564 878 23 Direct: +46 (0)8 564 878 29, Mobile: +46 70 643 9944 E-mail: steve.rapaport@seamless.se <mailto:steve.rapaport@seamless.sewww.seamless.se>* * <mailto:steve.rapaport@seamless.sewww.seamless.se>** <mailto:steve.rapaport@seamless.sewww.seamless.se>

« previous php.doc (#969363256) next »