コード例 #1
0
<?php

include '../src/Playsms/Webservices.php';
error_reporting(E_ALL ^ E_NOTICE);
$ws = new Playsms\Webservices();
$ws->url = 'http://playsms.org/trial/index.php?app=ws';
$ws->username = '******';
$ws->password = '******';
echo "\ngetToken\n";
$ws->getToken();
print_r($ws->getData());
echo "\n";
if ($ws->getStatus()) {
    echo "setToken:\n";
    $ws->token = $ws->getData()->token;
    $ws->setToken();
    print_r($ws->getData());
} else {
    echo "Error code: " . $ws->getError() . "\n";
    echo "Error string: " . $ws->getErrorString() . "\n";
}
echo "\n";
コード例 #2
0
<?php

include '../src/Playsms/Webservices.php';
error_reporting(E_ALL ^ E_NOTICE);
$ws = new Playsms\Webservices();
$ws->url = 'http://playsms.org/trial/index.php?app=ws';
$ws->username = '******';
$ws->password = '******';
echo "\ngetToken\n";
$ws->getToken();
print_r($ws->getData());
echo "\n";
if ($ws->getStatus()) {
    $ws->token = $ws->getData()->token;
    echo "Credit\n\n";
    $ws->getCredit();
    if ($ws->getStatus()) {
        $credit = $ws->getData()->credit;
        echo "Remaining credit for user " . $ws->username . ": " . $credit . "\n";
    } else {
        echo "Unable to check user credit\n";
    }
} else {
    echo "Error code: " . $ws->getError() . "\n";
    echo "Error string: " . $ws->getErrorString() . "\n";
}
echo "\n";
コード例 #3
0
<?php

include '../src/Playsms/Webservices.php';
error_reporting(E_ALL ^ E_NOTICE);
$ws = new Playsms\Webservices();
// if you want to test with other username
// go to http://playsms.id and register for username/password
// visit http://playsms.org/demo for more information
$ws->url = 'http://playsms.id/index.php?app=ws';
$ws->username = '******';
$ws->token = 'your_token';
$ws->to = 'destination_number';
$ws->msg = 'Hello u there, good morning';
$ws->nofooter = 1;
$ws->sendSms();
//print_r($ws) . PHP_EOL;
if ($ws->getStatus()) {
    echo "Status: TRUE" . PHP_EOL;
    $response = $ws->getData();
    print_r($response) . PHP_EOL;
} else {
    echo "Status: FALSE" . PHP_EOL;
    echo "Error code: " . $ws->getError() . PHP_EOL;
    echo "Error string: " . $ws->getErrorString() . PHP_EOL;
}
コード例 #4
0
<?php

include '../src/Playsms/Webservices.php';
error_reporting(E_ALL ^ E_NOTICE);
$ws = new Playsms\Webservices();
$ws->url = 'http://playsms.org/trial/index.php?app=ws';
$ws->username = '******';
$ws->password = '******';
echo "\ngetToken\n";
$ws->getToken();
print_r($ws->getData());
echo "\n";
if ($ws->getStatus()) {
    echo "Send SMS:\n";
    //Transferido para a propria API WEBSERVICE.PHP
    //$ws->token = $ws->getData()->token;
    $ws->to = '0987654321,0987654322';
    $ws->msg = 'This is a test from webservices ' . time();
    $ws->sendSms();
    print_r($ws->getData());
} else {
    echo "Error code: " . $ws->getError() . "\n";
    echo "Error string: " . $ws->getErrorString() . "\n";
}
echo "\n";
コード例 #5
0
ファイル: test.php プロジェクト: bradrmg/playsms-webservices
<?php

error_reporting(E_ALL ^ E_NOTICE);
require 'vendor/autoload.php';
$ws = new Playsms\Webservices();
// if you want to test with other username
// go to http://playsms.org/trial and register for username/password
// its a demo website, sms will not be sent to mobiles
$ws->url = 'http://playsms.org/trial/index.php?app=ws';
$ws->username = '******';
$ws->password = '******';
// get token from username and password
$ws->getToken();
if (!$ws->getStatus()) {
    echo "Error code: " . $ws->getError() . "\n";
    echo "Error string: " . $ws->getErrorString() . "\n";
    exit;
}
echo "Token: " . $ws->getData()->token . "\n";
// get user's credit
$ws->token = $ws->getData()->token;
$ws->getCredit();
$credit = $ws->getStatus ? $ws->getData()->credit : 0;
echo "User credit: " . $credit . "\n";
コード例 #6
0
ファイル: init.php プロジェクト: bradrmg/playsms-webservices
<?php

error_reporting(E_ALL ^ E_NOTICE);
require 'vendor/autoload.php';
$ws = new Playsms\Webservices();
include 'config.php';
// if you want to test with other username
// go to http://playsms.org/trial and register for username/password
// its a demo website, sms will not be sent to mobiles
$ws->url = $config['webservices_url'];
$ws->username = $config['webservices_username'];
$ws->token = $config['webservices_token'];
// get user's credit just to test authentication
$ws->getCredit();
$credit = $ws->getStatus() ? $ws->getData()->credit : 'ERR';
if ($credit == 'ERR') {
    header('Location: error_auth.html');
    exit;
}
if ($credit <= 0) {
    header('Location: error_fund.html');
    exit;
}
コード例 #7
0
ファイル: fn.php プロジェクト: yrahman/playSMS
function uplink_hook_getsmsstatus($gpid = 0, $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
    // global $plugin_config;
    // p_status :
    // 0 = pending
    // 1 = delivered
    // 2 = failed
    // dlr($smslog_id,$uid,$p_status);
    global $plugin_config;
    $db_query = "SELECT * FROM " . _DB_PREF_ . "_gatewayUplink WHERE up_local_smslog_id='{$smslog_id}'";
    $db_result = dba_query($db_query);
    if ($db_row = dba_fetch_array($db_result)) {
        $local_smslog_id = $db_row['up_local_smslog_id'];
        $remote_smslog_id = $db_row['up_remote_smslog_id'];
        $remote_queue_code = $db_row['up_remote_queue_code'];
        $dst = $db_row['up_dst'];
        if ($local_smslog_id && ($remote_smslog_id || $remote_queue_code && $dst)) {
            $ws = new Playsms\Webservices();
            $ws->url = $plugin_config['uplink']['master'] . '/index.php?app=ws';
            $ws->username = $plugin_config['uplink']['username'];
            $ws->token = $plugin_config['uplink']['token'];
            $ws->smslog_id = $remote_smslog_id;
            $ws->queue = $remote_queue_code;
            $ws->count = 1;
            $ws->getOutgoing();
            // _log('url:'.$ws->getWebservicesUrl(), 3, 'uplink getsmsstatus');
            $response = $ws->getData()->data[0];
            if ($response->status == 2) {
                $p_status = 2;
                dlr($local_smslog_id, $uid, $p_status);
            } else {
                if ($p_status = (int) $response->status) {
                    dlr($local_smslog_id, $uid, $p_status);
                }
            }
        }
    }
}