Пример #1
0
 $urlSMS = APP::getInstance()->config['url'];
 //génération texte suivant msg langue et code
 $sender = "GENDLOC";
 if ($msg == "Geoloc") {
     $text = "* Vérifier GPS et DATA à ON\r\n* Cliquer le lien " . $urlSMS . "/pos?c=" . $lastid . "\r\n* Accepter le partage\r\n* Patienter\r\n" . $unite;
 } elseif ($msg == "Tracking") {
     $text = "* Vérifier GPS et DATA à ON\r\n* Cliquer le lien " . $urlSMS . "/trace?c=" . $lastid . "\r\n* Accepter le partage\r\n" . $unite;
 }
 //envoi SMS et récupération du hash d'envoi
 // require('/js/thecallR/src/ThecallrClient.php');
 $config = APP::getInstance()->config['thecallr'];
 $thecallrLogin = $config['login'];
 $thecallrPassword = $config['password'];
 $THECALLR = new ThecallrClient($thecallrLogin, $thecallrPassword);
 $settings = $config['settings'];
 $res = $THECALLR->send($config['order']['set'], array($settings));
 // Options
 $options = new stdClass();
 $options->flash_message = FALSE;
 // "sms.send" method execution
 $result = $THECALLR->call($config['order']['send'], $sender, $tel, $text, $options);
 // The method returns the SMS ID
 $nModif = $DB->setSmsSend($lastid, $result);
 if ($nModif != 1) {
     throw new Exception("l'envoi du sms a échoué");
 }
 // Renvoi au navigateur du succès de l'envoi du sms
 $html = '</br>
      <table id="sms-table">
         <thead> <!-- En-tête du tableau -->
            <tr>
try {
    // The "system.get_timestamp" method returns THECALLR server timestamp
    $result = $THECALLR->call('system.get_timestamp');
    // Response display
    echo 'TheCallr server time : ' . date('Y-m-d H:i:s', $result) . '<br />';
} catch (Exception $error) {
    die($error->getMessage());
}
/**
* <h4>4. Method execution with one parameter</h4>
*/
try {
    // 1. "call" method: each parameter of the method to execute is provided as an argument
    $result = $THECALLR->call('apps.get_list', TRUE);
    // 2.  "send" method: all parameters of the method to execute are provided as an array
    $result = $THECALLR->send('apps.get_list', array(TRUE));
    // Response display
    echo '<pre>';
    print_r($result);
    echo '</pre>';
} catch (Exception $error) {
    die($error->getMessage());
}
/**
* <h4>5. Method execution with several parameters</h4>
*/
try {
    // WARNING
    // All the dates are GMT/UTC. Your country time offset is not handled
    date_default_timezone_set('UTC');
    // 1. "call" method