Hello
Did you solve your problem ?
Regards,
hh
<?phpecho "INDEX<br>";
/* * Command line script to send an outgoing SMS from the server. * * This example script queues outgoing messages using the local filesystem. * The messages are sent the next time EnvayaSMS sends an ACTION_OUTGOING request to www/gateway.php. */
require_once "config.php";require_once "EnvayaSMS.php";
$to = "3346080823"; //get these values from your database $body = "Prova"; //get these values from your database$message = new EnvayaSMS_OutgoingMessage();$message->id = uniqid("");$message->from = "3292666233"; //also this can be got from your database$message->to = $to;$message->message = $body;
file_put_contents("$OUTGOING_DIR_NAME/{$message->id}.json", json_encode($message)); //this stores the file json (the text message) in your serverecho "$OUTGOING_DIR_NAME/{$message->id}.json<br>";echo "Message {$message->id} added to filesystem queue\n";
//read files to check they have been stored correctly $messages = array();
$f=1;
$dir = $OUTGOING_DIR_NAME;
$files1 = scandir($dir);
foreach ($files1 as $i => $file ) {
if (preg_match('#\.json$#', $file))
{
$data = json_decode(file_get_contents("$OUTGOING_DIR_NAME/$file"), true); $tid = $data['id'];
$tto = $data['to'];
$tfrom = $data['from'];
$tmessage = $data['message']; echo "<p><b>$i: $file</b> || $OUTGOING_DIR_NAME</p> <p>ID: $tid</p> <p>to: $tto</p> <p>from: $tfrom</p> <p>Msg: $tmessage</p><hr>";
}
}
closedir($dir);
?>
if (sizeof($argv) == 3){ $to = $argv[1]; $body = $argv[2];}else{ error_log("Usage: php send_sms.php <to> \"<message>\""); error_log("Example: "); error_log(" php send_sms.php 16504449876 \"hello world\""); die;}