|
Hi Jeffrey,
we here at Asia Pacific College use an SMS modem with GSMLIB as the application... what I did was create my own PHP script to poll the modem and, if there are messages, will get them and save them into a MySQL database... the following is the script. i hope this can help you.
-------- start of script --------------
<?php require_once("db.config.php");?> <html> <head> <title>SMS Testing</title> </head>
<body> <?php $view_message = "gsmsmsstore -s /home/wwwrun/smsstore -l"; $delete_message = "gsmsmsstore -d /home/wwwrun/smsstore --delete 0";
function get_msg_no(){ global $cn; $select = "Select msg_no from " . cTBLLOG . " order by msg_no desc"; $rs = mysql_query($select,$cn) or die("Query Error1"); $rows = mysql_fetch_object($rs); $msg_no = $rows->msg_no; return $msg_no; }
exec($view_message,$com); $total = count($com);
if($total!=0){ $total = 16; $com[2] = substr($com[2],14); $sclen = strrpos($com[3],"'")-13; $com[3] = substr($com[3],13,$sclen); $com[4] = substr($com[4],23); $com[5] = substr($com[5],12); $com[6] = substr($com[6],27); $com[7] = substr($com[7],26); $oalen = strrpos($com[8],"'")-22; $com[8] = substr($com[8],22,$oalen); $com[9] = substr($com[9],21); $com[10] = substr($com[10],20); $com[11] = substr($com[11],14);
$com[12] = substr($com[12],17); $com[13] = substr($com[13],18); $udlen = strrpos($com[14],"'")-12; $com[14] = substr($com[14],12,$udlen); $com[14] = addslashes($com[14]); for($i=0;$i<=$total;$i++){ echo $com[$i] . "<br>"; }
$msg_no = get_msg_no(); $msg_no = $msg_no + 1; $insert_record = "insert into " . cTBLLOG . " (msg_no,msg_type,sc_address,mmts,reply_path,ud_hi,status_report,orig_address,prot_iden,data_coding,sc_timestamp,ud_length,ud_header,user_data) values ('$msg_no','$com[2]','$com[3]','$com[4]','$com[5]','$com[6]','$com[7]','$com[8]','$com[9]','$com[10]','$com[11]','$com[12]','$com[13]','$com[14]')"; mysql_query($insert_record) or die("Query Error2");
exec($delete_message,$str,$ret); }else{ echo "No SMS Messages"; }
?> </body> </htm
-------- end of script --------------
-------Original Message-------
Date: 06/30/04 14:41:16
Subject: [plug] Store SMS to database
Good Day!
Does anyone know a tool that works like Gnokii and can store
retrieved and sent SMS to a database (more specifically a MySQL
database)? We have tried using a couple of applications that connects a
mobile phone to a PC (we are currently using gnokii) but we haven't seen
a software that can save SMS directly to a database. Any suggestions
would really be appreciated..
thanks in advance...
--
learning while lurking
--
Philippine Linux Users' Group (PLUG) Mailing List
..
..
Are you a Linux newbie? To join the newbie list, go to
|