Jump to content

Recommended Posts

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 ?

 

exec("mode COM27 BAUD=9600 PARITY=N data=8 stop=1 xon=off");  
$fp = fopen ("COM27:", "w+"); 
if (!$fp) 
{    
echo "Not open"; 
} 
else 
{
echo "opened";
fclose($fp);	
}

 

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

Link to comment
https://forums.phpfreaks.com/topic/267110-serial-port-communication-issue/
Share on other sites

You could try the php_serial class and see if that helps, if not the PHP-DIO library might help.

If neither does, then it might be a problem caused by the virtual status of that COM port. Which will require some further investigation, and probably a call to the USB device directly (avoiding the virtual COM port).

Thank you Christian for the reply, I have no luck with php_serial_class, and PHP-DIO gave me the same result as fopen, ie only works with port 1 t0 4, I found some articles regarding to the same issues, seems like it works fine with ubuntu but not with windows. I have no idea why  :(  is there any way to work around the issue, except for changing the OS  :shrug:

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.