168 lines
No EOL
8.6 KiB
PHP
168 lines
No EOL
8.6 KiB
PHP
<?php
|
|
header("Content-Type: text/html; charset=utf-8");
|
|
error_reporting(E_ALL); ini_set('display_errors',1);
|
|
require('lib/config.php');
|
|
session_name(CONFIG_SESSION); session_start();
|
|
require('lib/mysql.class.php');
|
|
include_once('lib/class.mysms.php');
|
|
$GLOBALS['mysql'] = new mysql(CONFIG_MYSQL_HOST,CONFIG_MYSQL_USER,CONFIG_MYSQL_PW,CONFIG_MYSQL_DB);
|
|
date_default_timezone_set('Europe/London');
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
//------------------------------------------------- abfragen -----------------------------------------------------
|
|
//----------------------------------------------------------------------------------------------------------------
|
|
//$api_key = 'EPOcWC8smWfdOWNHzSLANw'; // Frank
|
|
$api_key = 'OvHiwonvVKneoYttEOE64g'; // Jörg
|
|
//$api_key = 'VpvwO69wy5QxrNSKIa9ryA'; // Max
|
|
|
|
$mysms = new mysms($api_key);
|
|
$login_data = array('msisdn' => '491777842986', 'password' => 'Laden-0815');
|
|
$login = $mysms->ApiCall('json', '/user/login', $login_data);
|
|
$user_info = json_decode($login);
|
|
$_SESSION['AuthToken'] = $user_info->authToken;
|
|
$mysms->setAuthToken($user_info->authToken);
|
|
|
|
$syncs = array('messageId' => 434478);
|
|
$syncsacks= array('messageId' =>"434478",'operation' =>"0");
|
|
//$syncs= json_encode($syncs);
|
|
//$msisdn = "+4915756088154";
|
|
|
|
$msisdn = "+491783481356"; //jörg
|
|
$frank = "+4916094934507";
|
|
$jbsms = "+491777842986"; //
|
|
$callnr = "+4917645835619"; //justin
|
|
//$msisdn = "+4915210141361"; //ali asghar
|
|
$sms_text='Testnachricht Server V4.052';
|
|
//$mid="453691";
|
|
|
|
$req_data = array('apiKey' => $api_key,'msisdn' => $jbsms,'password' => 'Laden-0815','recipient' => $frank,'message' => $sms_text);
|
|
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken']);
|
|
echo "<pre>"; print_r($req_data); echo "</pre>";
|
|
$ergebnis = $mysms->ApiCall('json', '/message/send', $req_data);
|
|
echo "<pre>"; print_r($mysms); echo "</pre>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//$req_data = array('apiKey' => $api_key,'msisdn' => $msisdn); //providing // ---------------
|
|
//$req_data = array('apiKey' => $api_key,'messageId' => $mid,'read' => false); //providing
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken']); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/get/byconversation', $req_data); //calling method ->ApiCall
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/getconversations', $req_data); //calling method ->ApiCall
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/conversations/get', $req_data); //calling method ->ApiCall // GEHT
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/conversations/get', $req_data); //calling method ->ApiCall
|
|
|
|
|
|
//-------------- funktioniert mit kurztest ----------------
|
|
// $req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken']);
|
|
// $ergebnis = $mysms->ApiCall('json', '/user/message/conversations/get', $req_data); //calling method ->ApiCall // GEHT
|
|
|
|
//$tmp2=$jsonrow->messages[0]->status;
|
|
|
|
//$req_data = array('apiKey' => $api_key,'msisdn' => $msisdn); //providing // ---------------
|
|
//$req_data = array('apiKey' => $api_key,'messageId' => $mid,'read' => false); //providing
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken']); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/getconversations', $req_data); //calling method ->ApiCall
|
|
|
|
// funktioniert .. abfrage ohne status und text gekürzt
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken']); //providing
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'address' => $msisdn); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/conversations/get', $req_data); //calling method ->ApiCall // GEHT
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// funktioniert bestens .. abfrage nach empfängernummer, liest aber auch empfangene SMS ein.
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'address' => $msisdn,'offset' => 1,'limit' => 100); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/get/by/conversation', $req_data); //calling method ->ApiCall
|
|
|
|
//--------------------------------------------------------------------------------------------------------------------------
|
|
/*
|
|
$i = 0;
|
|
while($i < 10) {
|
|
$test = $GLOBALS['mysql']->query_single("SELECT * FROM log_sms WHERE messageId='".$jsonrow->messages[$i]->messageId."' and sender_id=18");
|
|
if($test['num_rows']!=0) {
|
|
//---------------------------- SMS in Datenbank
|
|
} else {
|
|
//---------------------------- SMS nicht Datenbank
|
|
echo "SmS nicht gefunden."; }
|
|
echo '<br>';
|
|
|
|
|
|
echo "Id: ".$jsonrow->messages[$i]->messageId;
|
|
echo "- St: ".$jsonrow->messages[$i]->status;
|
|
echo "- in: ".$jsonrow->messages[$i]->incoming;
|
|
echo '<br>';
|
|
//------------------
|
|
$i++;
|
|
}
|
|
*/
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
//$req_data = array('apiKey' => $api_key,'msisdn' => $msisdn,'flashSms' => 'False'); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/msisdn/verify', $req_data); //calling method ->ApiCall
|
|
|
|
// geht nicht :( irgendwas fehlt
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
//$testsync= array('incoming' =>0);
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'syncs' => $testsync,'syncLimit' => 10); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/message/sync', $req_data); //calling method ->ApiCall
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//---------- abfrage status test
|
|
// $req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'os' => 1); //providing
|
|
// $ergebnis = $mysms->ApiCall('json', '/sms/connector/connectors/get', $req_data);
|
|
|
|
//---------- abfrage device id Jörg =17
|
|
// $req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'deviceId' => 3); //providing
|
|
// $ergebnis = $mysms->ApiCall('json', '/user/call/sync', $req_data);
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'limit' => 1); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/call/get', $req_data);
|
|
//echo "<pre>"; print_r($ergebnis); echo "</pre>";
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'deviceId' => 3,'syncInitial' =>true, 'syncLimit'=>1); //providing
|
|
//$ergebnis = $mysms->ApiCall('json', '/user/call/sync', $req_data);
|
|
//echo "<pre>"; print_r($ergebnis); echo "</pre>";
|
|
|
|
//------------------------------------------------------------------------------------------------------------------
|
|
//---------- abfrage status einstellungen
|
|
// $req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken']); //providing
|
|
// $ergebnis = $mysms->ApiCall('json', '/rest/config/countries/get', $req_data);
|
|
|
|
|
|
//---------- abfrage status einstellungen
|
|
//$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'limit' => 1); //providing
|
|
//$data = $mysms->ApiCall('json', '/user/call/get', $req_data);
|
|
//$jsonrow=json_decode($data);
|
|
|
|
// echo "ID :".$jsonrow->calls[0]->callId;
|
|
// echo "Nr :".$jsonrow->calls[0]->address;
|
|
// echo "ID :".$jsonrow->calls[0]->status;
|
|
// echo "<pre>"; print_r($jsonrow); echo "</pre>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------- abfrage anrufe in abwesendheit -- geht
|
|
// $req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken']); //providing
|
|
// $ergebnis = $mysms->ApiCall('json', '/user/call/count/unread', $req_data);
|
|
// echo "data: ".$jsonrow->unreadCount;
|
|
|
|
// $req_data = array('authToken' => $_SESSION['AuthToken'], 'address'=> $abfrage['nummer'], 'query'=> utf8_decode($abfrage['text']));
|
|
// $ergbniss = $mysms->ApiCall('json', '/user/message/search', $req_data);
|
|
|
|
|
|
// echo "<pre>"; print_r($jsonrow); echo "</pre>";
|
|
echo "<pre>"; print_r($ergebnis); echo "</pre>";
|
|
//-----------------------------------------------------------
|
|
|
|
//}
|
|
?>
|