note 44004 modified in function.fopen by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 12 Jul 2004 11:09:17 +0000 |
| Subject: | note 44004 modified in function.fopen by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73092@lists.php.net to get a copy of this message | ||
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.";
}
?>
--was--
A simple little script to send SMS messages through a GSM phone connected to a serial communications
port (win32). Tested on a Nokia 6310i:
$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.";
}
http://php.net/manual/en/function.fopen.php