Пример #1
0
<?php

function gw_send_sms($user, $pass, $sms_from, $sms_to, $sms_msg)
{
    $query_string = "api.aspx?apiusername="******"&apipassword="******"&senderid=" . rawurlencode($sms_from) . "&mobileno=" . rawurlencode($sms_to);
    $query_string .= "&message=" . rawurlencode(stripslashes($sms_msg)) . "&languagetype=1";
    $url = "http://gateway.onewaysms.com.au:10001/" . $query_string;
    $fd = @implode('', file($url));
    if ($fd) {
        if ($fd > 0) {
            print "MT ID : " . $fd;
            $ok = "success";
        } else {
            print "Please refer to API on Error : " . $fd;
            $ok = "fail";
        }
    } else {
        // no contact with gateway
        $ok = "fail";
    }
    return $ok;
}
print "Sending to one way sms " . gw_send_sms("apiusername", "apipassword", "senderid", "61412345678", "test message");
Пример #2
0
function resend($smslog_id, $override = false)
{
    if (!$override) {
        // pause for a bit to allow
        // whatever's wrong with the gateway
        // to clear itself out
        sleep(RESEND_SLEEP);
    }
    $db = DB_DataObject::factory(playsms_tblSMSOutgoing);
    if ($db->get($smslog_id)) {
        $newtrycount = $db->send_tries + 1;
        if ($override || 0 != (int) fmod($newtrycount, SEND_TRY_MAX)) {
            $db->send_tries = $newtrycount;
            $db->p_update = date();
            $db->update();
            error_log("resending (attempt {$db->send_tries})");
            gw_send_sms($db->p_src, $db->p_dst, $db->p_msg, PV, $db->uid, $db->smslog_id, $db->p_sms_type, $db->unicode);
        }
    }
}