<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="sr-RS">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php


/*
 *
 * Demo: mag_get_promet.php
 *  
 */
 

date_default_timezone_set("Europe/Belgrade");
 
include_once '../apitest/infoapi/infoapi.php';
include_once 'mag_get_promet_params.php';

$miapiHandler = new iapiHandler;
$miapiHandler->APIServerURL = SERVER_URL;

$miapiHandler->DebugLevel = DEBUG_LEVEL;
$miapiHandler->DebugSections = DEBUG_SECTIONS;


// naziv API funkcije koja se poziva
$mAPIFunctionName = 'MAG_GET_PROMET';

$mQueryEnvelope = new iapiQueryEnvelope ($mAPIFunctionName);
$mQueryEnvelope->username = USERNAME;
$mQueryEnvelope->password = PASSWORD;

$mQueryData = new MagGetPrometParams();
$mQueryData->start_time = new DateTime("2015-02-24");
$mQueryData->end_time = new DateTime();

//$mQueryEnvelope->data->start_time = new DateTime("2015-02-24");
//$mQueryEnvelope->data->end_time = new DateTime();

$mQueryEnvelope->data = $mQueryData;

$mQuery = $mQueryEnvelope;
$mResponse  = $miapiHandler->Execute($mQuery);


$m_error = false;

if ($mResponse->error_state !='ok') {
  $m_error = true;
?>
Greska: <?php echo $mResponse->error_state; ?> - <?php echo $mResponse->error_message; ?>
<?php
} else {

  if ($mResponse->data->error_state !='ok') {
    $m_error = true;
?>
Greska: <?php echo $mResponse->data->error_state; ?> - <?php echo $mResponse->data->error_message; ?>
<?php
  }

}
?>

<hr />

<?php
if (!$m_error) {
  $m_result = $mResponse->data;
} else {
  $m_result = 'ERR';
}  //  if (!$m_error) 
?>

<hr />
<?php include_once '../apitest/inc_sysinfo.php'; ?>

</body>
</html>