コード例 #1
0
ファイル: intouch_example.php プロジェクト: askzap/ultimate
$password = "******";
// Test data
$contactId;
// Received after creating the contact.
$firstname = "John";
$lastname = "Doe";
$phonenumber = "4712345678";
// Modify to a valid mobile number.
$description = "This info was input with a REST PUT request";
$messagetext = "Hello! This message was sent by posting to the Intouch REST API.";
$sendernumber = "IntouchAPI";
// Must be a valid sendernumber set up for your account
// Setting up Pest with URL for the Intouch API and basic HTTP authentication
require_once '../Pest.php';
$pest = new Pest('http://intouchapi.pswin.com/1/');
$pest->setupAuth($user . "@" . $logindomain, $password);
$pest->curl_opts[CURLOPT_FOLLOWLOCATION] = false;
// Not supported on hosts running safe_mode!
echo "<h1>1. Creating a contact in the address book</h1>";
try {
    $contactdata = array('Firstname' => $firstname, 'Lastname' => $lastname, 'PhoneNumber' => $phonenumber);
    $contactjson = $pest->post('/contacts', $contactdata);
    $contactarray = json_decode($contactjson, true);
    $contactId = $contactarray[ContactId];
    echo "<br>Created contact with id: " . $contactId;
} catch (Exception $e) {
    echo "<br>Caught exception when creating contact : " . $e->getMessage() . "<br>";
}
echo "<h1>2. Getting the contact by its phonenumber and updating it.</h1>";
try {
    $contactjson = $pest->get('/contacts/phonenumber/' . $phonenumber);
コード例 #2
0
 public function ajaxHandler()
 {
     switch ($_REQUEST['command']) {
         case 'getJSON':
             switch ($_REQUEST['jdata']) {
                 case 'grid':
                     $data = array_values($this->getAllUsers());
                     if ($data) {
                         return $data;
                     } else {
                         return array();
                     }
                     break;
                 default:
                     return false;
                     break;
             }
             break;
         case 'listApps':
             $ariuser = $this->Conf->get_conf_setting('FPBX_ARI_USER');
             $aripass = $this->Conf->get_conf_setting('FPBX_ARI_PASSWORD');
             $pest = new \Pest('http://localhost:8088/ari/');
             $pest->setupAuth($ariuser, $aripass);
             $apps = $pest->get('/applications');
             return json_decode($apps);
             break;
         default:
             return false;
             break;
     }
 }