error run php script in ubuntu server terminal -
i'm confuse right now..i make php script send sms gammu , put in home directory
<?php mysql_connect("localhost","username","password") or die("failed"); mysql_select_db("database1") or die("database failed"); $not_send = mysql_query("select * outbox status=0"); while($sending = mysql_fetch_array($not_send)){ $msg_id = $sending['id']; $text = "gammu --sendsms text ".$sending['phonenum']." -text ".$sending['content']; $sms = shell_exec($text); if(preg_match("/ok/im", $sms)){ mysql_query("delete outbox id = '$msg_id'"); } } ?>
i confirm $text
output echo $text
, when run in terminal php send_sms.php
unexpected '('
can tell me whats wrong here??or cant put run php script outside /var/www/?? please me..
i solved problem thankx @zerkms..i dont quote $sending['content']
part in earlier code...
so new code:
<?php mysql_connect("localhost","username","password") or die("failed"); mysql_select_db("database1") or die("database failed"); $not_send = mysql_query("select * outbox status=0"); while($sending = mysql_fetch_array($not_send)){ $msg_id = $sending['id']; $text = "gammu --sendsms text ".$sending['phonenum']." -text '".$sending['content'."'"]; $sms = shell_exec($text); if(preg_match("/ok/im", $sms)){ mysql_query("delete outbox id = '$msg_id'"); } } ?>
if have same problem hope search engine find this...once again thank zerkms
Comments
Post a Comment