113 lines
No EOL
3.6 KiB
PHP
113 lines
No EOL
3.6 KiB
PHP
<?php
|
|
|
|
//------------------------------------------------- sms Verzeichnis -----------------------------------------------------
|
|
|
|
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';
|
|
$mysms = new mysms($api_key);
|
|
$login_data = array('msisdn' => '4916094934507', 'password' => 'maxdata-01');
|
|
$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 = "16094934507";
|
|
$mid="453659";
|
|
|
|
|
|
|
|
|
|
|
|
//-------------- funktioniert nach nummer . mit status
|
|
$req_data = array('apiKey' => $api_key,'authToken' => $_SESSION['AuthToken'],'address' => $msisdn,'offset' => 1,'limit' => 1); //providing
|
|
$ergebnis = $mysms->ApiCall('json', '/user/message/get/by/conversation', $req_data); //calling method ->ApiCall
|
|
|
|
|
|
|
|
$jsonrow=json_decode($ergebnis, true);
|
|
// echo "<pre>"; print_r($jsonrow); echo "</pre>";
|
|
|
|
|
|
//echo "<pre>"; print_r($jsonrow['messages']); echo "</pre>";
|
|
|
|
foreach($jsonrow['messages'] as $row) {
|
|
if(isset($row['incoming'])) { echo $row['incoming']; }
|
|
echo "<pre>"; print_r($row); echo "</pre>";
|
|
if($row['incoming'] == 1) {
|
|
$gelesen=$row['read'];
|
|
$smstest = $GLOBALS['mysql']->query_single("SELECT * FROM sms WHERE messageId='".$row['messageId']."'");
|
|
if($smstest['num_rows']!=0) {
|
|
|
|
$GLOBALS['mysql']->insert("UPDATE sms SET senddate='".substr($row['dateSent'], 0, -3)."' WHERE messageId='".$row['messageId']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE sms SET statusdate='".substr($row['dateStatus'], 0, -3)."' WHERE messageId='".$row['messageId']."'");
|
|
$GLOBALS['mysql']->insert("UPDATE sms SET status='".$row['status']."' WHERE messageId='".$row['messageId']."'");
|
|
} else {
|
|
$smsname = $GLOBALS['mysql']->query_single("SELECT * FROM mitarbeiter WHERE handy='".$row['address']."'");
|
|
if($smsname['num_rows']!=0) { $ename=$smsname['name']; } else { $ename="unkown"; }
|
|
|
|
|
|
$GLOBALS['mysql']->insert("INSERT INTO sms (messageId,nummer,text,incoming,gelesen,status,senddate,statusdate,e_name)
|
|
VALUES(
|
|
'".$row['messageId']."',
|
|
'".$row['address']."',
|
|
'".$row['message']."',
|
|
'".$row['incoming']."',
|
|
'".$gelesen."',
|
|
'".$row['status']."',
|
|
'".substr($row['dateSent'], 0, -3)."',
|
|
'".substr($row['dateStatus'], 0, -3)."',
|
|
'".$ename."'
|
|
)");
|
|
|
|
|
|
|
|
|
|
}
|
|
} else {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
// echo "<pre>"; print_r($jsonrow); echo "</pre>";
|
|
|
|
|
|
// $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($ergebnis); echo "</pre>";
|
|
//-----------------------------------------------------------
|
|
|
|
//}
|
|
?>
|