fopen() serial port

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 19
Joined: Wed Aug 17, 2005 6:00 am

Wed Aug 15, 2012 2:18 am

Good day all :
I have an issue here, i try to use php to send the SMS via my 3G USB modem, as I try to send it with hyperterminal, it works perfectly with COM port number 27.
as I try to fopen COM port 27 it return with the following error message : Warning: fopen(COM27:) [function.fopen]: failed to open stream: Invalid argument in C:\AppServ\www\home\test\sms\com_connect.php on line 4

but if i fopen the COM port 1 to 4, it actually connected to the COM port, which means I can only connect to COM port 1 to 4, from COM5 onward, i wont be able to connect. any idea why ?

Code: Select all

exec("mode COM27 BAUD=9600 PARITY=N data=8 stop=1 xon=off");  
$fp = fopen ("COM27:", "w+"); 
if (!$fp) 
	echo "Not open"; 
	echo "opened";
P.S. I use the port monitor software to monitor the ports, when I connect to COM port 1-4 it actually receive the request, but it receive nothing when I try COM5 onward.
and I'm running apache on windows. please help. and thank you in advance

Post Reply