コード例 #1
0
//curl data from DB  to sms_api;
require_once './mail_db_conn.php';
$conn = db_connect();
$SELECT_SQL = " SELECT sms_queue.id,sms_queue.content,receiver_info.phone_number\n\t\tFROM  sms_queue,receiver_info \n\t\tWHERE sms_queue.contact = receiver_info.user_name\n\t\tAND sms_queue.send_result = 'pending'; ";
include "./SendSMS.php";
while ("ok") {
    $SELECT_RESULT = mysql_query($SELECT_SQL, $conn);
    if ($SELECT_RESULT) {
        while ($SELECT_ARRAY = mysql_fetch_array($SELECT_RESULT)) {
            $datetime = date('Y-m-d H:i:s');
            file_put_contents("log/ops_system.log", $datetime . "Select_result: " . $SELECT_ARRAY['phone_number'] . " - " . $SELECT_ARRAY['content'] . ".\n", FILE_APPEND);
            $RESPONDS = SEND_SMS($SELECT_ARRAY['phone_number'], $SELECT_ARRAY['content']);
            if ($RESPONDS == "true") {
                $UPDATE_SQL = "UPDATE sms_queue SET send_result = 'success' WHERE id='" . $SELECT_ARRAY['id'] . "';";
            } else {
                $RESPONDS = SEND_SMS($SELECT_ARRAY['phone_number'], $SELECT_ARRAY['content']);
                if ($RESPONDS == "true") {
                    $UPDATE_SQL = "UPDATE sms_queue SET send_result = 'success' WHERE id='" . $SELECT_ARRAY['id'] . "';";
                } else {
                    $UPDATE_SQL = "UPDATE sms_queue SET send_result = 'fail' WHERE id='" . $SELECT_ARRAY['id'] . "';";
                }
            }
            mysql_query($UPDATE_SQL, $conn);
            file_put_contents("log/ops_system.log", $datetime . " Finished - Update: " . $UPDATE_SQL . ".\n", FILE_APPEND);
        }
    }
    #$UPDATE_SQL_S = "update sms_queue set send_result = 'skip' where send_result = 'pending';";
    #mysql_query($UPDATE_SQL_S,$conn);
    sleep(1);
}
コード例 #2
0
    //$url = "http://192.168.111.189:5180/NotificationService/services/notification";
    $url = "http://sms.4000966666.com:9000/NotificationService/services/notification";
    $content = $content . " 【中交兴路】";
    $post_field = GET_POST_FIELD($receivers, $content);
    //var_dump($post_field);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "{$post_field}");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $rsp = curl_exec($ch);
    //$rsp = trim($rsp);
    var_dump($rsp);
    $datetime = date('Y-m-d H:i:s');
    if (preg_match("/success/", $rsp)) {
        #file_put_contents("log/ops_system.log",$datetime." send sms success.\n",FILE_APPEND);
        file_put_contents("log/ops_system.log", $datetime . "receiver: " . $receivers . "; content:" . $content . "send sms success.\n", FILE_APPEND);
        return "true";
    } else {
        #file_put_contents("log/ops_system.log",$datetime." send sms failed.\n",FILE_APPEND);
        file_put_contents("log/ops_system.log", $datetime . "receiver: " . $receivers . "; content:" . $content . " send sms failed.\n", FILE_APPEND);
        return "false";
    }
    curl_close($ch);
}
//$OP_RESULT = SEND_SMS("13911484765","【中交兴路监控平台】:测试 中交兴路监控平台各位领导客车平台出现异常情况!");
$OP_RESULT = SEND_SMS("13520181582", "【中交兴路监控平台】:测试 中交兴路监控平台各位领导客车平台出现异常情况!");
//$OP_RESULT = SEND_SMS("13801035856","<From 21ViaNet> 192.168.111.181(chpt_m_01) : Swap SWAP OK - 100% free (4094 MB out of 4094 MB)");
echo $OP_RESULT;
#$OP_RESULT1 = SEND_SMS("18611153002","1<From 21ViaNet> 192.168.111.181(chpt_m_01) : Swap SWAP OK - 100% free (4094 MB out of 4094 MB)");
#echo $OP_RESULT1;
コード例 #3
0
    $num_rows = mysql_num_rows($result);
    if ($num_rows > 0) {
        while ($row = mysql_fetch_array($result)) {
            // collect user information
            $user_fname = $row['user_fname'];
            $email_id = $row['user_email'];
            $subject_title = "SKOL Test remainder";
            $user_phone = $row['user_phone'];
            $message_body = "Dear " . $row['user_fname'] . ", \nThere is an Test coming up in " . $row['course_name'] . " - " . $row['subject_name'] . " - " . $row['test_name'] . " on tomorrow Date " . $row['schedule'] . "\nAll The Best. \nThanks and Regards \nSKOL System \nadmin@skolsystem.com.";
            // send email
            $email_status = SEND_EMAIL($email_id, $subject_title, $message_body);
            if ($email_status) {
                $email_sent++;
            }
            // send sms
            $schedule_id = SEND_SMS($user_phone, $message_body);
            if (isset($schedule_id)) {
                $user_phone = trim($user_phone);
                $query = mysql_query("insert into unsend_sms_alert(user_fname,email_id,user_phone,message_body,sms_response) values('" . $user_fname . "','" . $email_id . "'," . $user_phone . ",'" . $message_body . "','" . $schedule_id . "');");
                if (isset($query)) {
                    $sms_count++;
                } else {
                    echo "<p> Failed to update in unsent_sms_alert </p> \n";
                }
            }
        }
    } else {
        echo "There is no SMS remainder all sent successfully ! <br> \n";
    }
}
// Check for sms status ---------------------------------- START --------------
コード例 #4
0
<?php

include_once "../SendSMS.php";
$NotificationResult = file_get_contents("./result.txt");
//echo $NotificationResult;
SEND_SMS("13911484765,15810613566", "[ZJXL_IT From tiger]\n{$NotificationResult}.");
//SEND_SMS("18610212142","【中交兴路监控平台】:短信通讯正常!你该下班了!]");