yohaneshs: I already solve the problem. :)
Thanks for your respon freeshman. :D
|
yohaneshs: I install sms server tools in debian server and I want to every incoming sms automatically forward to mysql.
I use this php to forward my incoming sms to mysql table but I must always running this script manually.
#!/usr/bin/php
<?php
include ("config.php");
$dt_now = date('Y-m-d');
$noto = array(1=>'From:',2=>'Received:',3=>'Sent:');
foreach (glob("../../../sms/incoming/*.*") as $filename) {
$name = basename($filename);
$myfile = fopen($filename, "r") or die("Unable to open file!");
$lines = array();
// Output one line until end-of-file
while(!feof($myfile)) {
$lines[] = fgets($myfile);
}
fclose($myfile);
$no = str_replace($noto,'',$lines[0]);
$kirim = str_replace($noto,'',$lines[3]);
$terima = str_replace($noto,'',$lines[4]);
if(substr($name, 0, 5) == 'GSM1.'){
$masuk = mysql_query("INSERT INTO SMS_terima values('$name','$no','$lines[12]','$kirim','$terima','','0','','0','0')");
}
}
?>
This is log from smsd
2014-12-24 16:13:03,5, GSM1: SMS received (part 3/3), From: 6285261465257
2014-12-24 16:13:03,6, GSM1: Wrote an incoming message file: /home/sms/incoming/GSM1.L7yJkp
2014-12-24 16:13:03,7, GSM1: Running eventhandler: /home/webmaster/sms_healing/public_html/scandir.php RECEIVED /home/sms/incoming/GSM1.L7yJkp
2014-12-24 16:13:03,7, GSM1: Done: eventhandler, execution time 0 sec., status: 0 (0)
2014-12-24 16:13:03,3, GSM1: Exec: eventhandler said something:
2014-12-24 16:13:03,3, GSM1: !
2014-12-24 16:13:03,3, GSM1: !
2014-12-24 16:13:03,3, GSM1: !
2014-12-24 16:13:03,6, GSM1: Deleting message 3
2014-12-24 16:13:04,7, GSM1: -> AT+CMGD=3
2014-12-24 16:13:04,7, GSM1: Command is sent, waiting for the answer
can you help me, why this script not running in eventhandler smsd?
Thank you...
|