<?php

use infobip\DataConnectionProfileClient;
require_once 'app.php';
$address = getFormParam('address');
$notifyURL = getFormParam('notifyURL');
if (!$address) {
    redirectWithFormError('send-roaming-status-form.php', 'Address field is mandatory');
}
// Initialize the client:
$dataConnectionProfileClient = new DataConnectionProfileClient(USERNAME, PASSWORD);
try {
    if ($notifyURL) {
        $result = $dataConnectionProfileClient->retrieveRoamingStatus($address, $notifyURL);
        $message = '<h1>Request sent</h1>';
        $message .= '<p>The result will be pushed back to ' . $notifyURL . '</p>';
        redirectWithFormSuccess('send-roaming-status-form.php', $message);
    } else {
        $result = $dataConnectionProfileClient->retrieveRoamingStatus($address);
        $message = '<h1>Request sent</h1>';
        $message .= '<p>Mobile network code: ' . $result->servingMccMnc->mnc . '</p>';
        $message .= '<p>Mobile country code: ' . $result->servingMccMnc->mcc . '</p>';
        $message .= '<p>Roaming status: ' . $result->currentRoaming . '</p>';
        redirectWithFormSuccess('send-roaming-status-form.php', $message);
    }
} catch (Exception $e) {
    redirectWithFormError('send-roaming-status-form.php', 'Error checking roaming status:' . $e->getMessage());
    return;
}
<?php

use infobip\DataConnectionProfileClient;
use infobip\utils\Logs;
require_once __DIR__ . '/../vendor/autoload.php';
$client = new DataConnectionProfileClient(USERNAME, PASSWORD);
$client->login();
# example:retrieve-roaming-status-with-notify-url
$response = $client->retrieveRoamingStatus(DESTINATION_ADDRESS, NOTIFY_URL);
// if there is no error the query has been succesfully executed
if (!$response->isSuccess()) {
    echo 'Error:', $response->exception, "\n";
    Logs::printLogs();
}
# ----------------------------------------------------------------------------------------------------
echo $response;
echo NOTIFY_URL;
Esempio n. 3
0
<?php

use infobip\DataConnectionProfileClient;
require_once __DIR__ . '/../vendor/autoload.php';
# example:data-connection-client
$client = new DataConnectionProfileClient(USERNAME, PASSWORD);
# ----------------------------------------------------------------------------------------------------
//$client->login();
# example:retrieve-roaming-status
$response = $client->retrieveRoamingStatus(DESTINATION_ADDRESS);
echo 'Number context result: \\n<br>';
echo 'servingMccMnc: ', $response->servingMccMnc, '\\n<br>';
echo 'address: ', $response->address, '\\n<br>';
echo 'currentRoaming: ', $response->currentRoaming, '\\n<br>';
echo 'resourceURL: ', $response->resourceURL, '\\n<br>';
echo 'retrievalStatus: ', $response->retrievalStatus, '\\n<br>';
echo 'callbackData: ', $response->callbackData, '\\n<br>';
echo 'extendedData: ', $response->extendedData, '\\n<br>';
echo 'IMSI: ', $response->extendedData->imsi, '\\n<br>';
echo 'destinationAddres: ', $response->extendedData->destinationAddress, '\\n<br>';
echo 'originalNetworkPrefix: ', $response->extendedData->originalNetworkPrefix, '\\n<br>';
echo 'portedNetworkPrefix: ', $response->extendedData->portedNetworkPrefix, '\\n<br>';
# ----------------------------------------------------------------------------------------------------
//Logs::printLogs();