Search code examples
phpsmsmodem

Connect to port using php_serial_class every minute


If I have a script which will send sms every minute using crontab :

$sql = "SELECT * FROM table WHERE Status = '0' LIMIT 0,6";
$query = mysql_query($sql);

$serial = new Sms_Serial;
$serial->deviceSet("/dev/ttyUSB0");
$serial->confBaudRate(115200);
$serial->confParity('none');
$serial->confCharacterLength(8);

    while ($row = mysql_fetch_array($query))
         {
         $serial->deviceOpen();

         //sending....

         $serial->deviceClose();
         }

Which means it will detect the port and set BaudRate to send few sms every minute.Will it bring any damage to the port or modem?Some of my ports will not able to detect SIM card anymore after some days,I'm not sure whether is the modem quality problem or my script problem.

Thank you.


Solution

  • Have you tried checking to see what happens if it doesn't send the message? Mainly I see that the modem does not support so many traffic/connection and then there might be a bug in your code where if the message is not sent will try to send it again and so on and on instead of reporting it and "pause" the process until you see what is happening, that causes a lot of traffic and if your modem doesn't take it, it will get fried eventually .