<?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;
<?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; require_once 'app.php'; $result = DataConnectionProfileClient::unserializeRoamingStatus(); // Process the roaming status here... // We'll just save this object: $fileName = PUSH_LOG_DIRECTORY . '/roaming-status-' . strftime('%Y-%m-%d %H:%M') . '.txt'; $data = print_r($result, true); file_put_contents($fileName, $data); // Not needed, but just for testing: echo 'OK';
<?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();
<?php use infobip\DataConnectionProfileClient; require_once '../vendor/autoload.php'; $string = '{"terminalRoamingStatusList":{"roaming":{"address":"38598123456","currentRoaming":"NotRoaming","servingMccMnc":{"mcc":"219","mnc":"01"},"resourceURL":null,"retrievalStatus":"Retrieved","extendedData":{"destinationAddress":"38598123456","statusId":5,"doneTime":1345454221270,"pricePerMessage":5.0,"mccMnc":"21901","servingMsc":"38598042001","censoredServingMsc":"3859804","gsmErrorCode":0,"originalNetworkName":"T-Mobile HR","portedNetworkName":"T-Mobile HR","servingHlr":"3859812005","imsi":"219014100019459","originalNetworkPrefix":"98","originalCountryPrefix":"385","originalCountryName":"Croatia","isNumberPorted":false,"portedNetworkPrefix":"97","portedCountryPrefix":"385","portedCountryName":"Croatia","numberInRoaming":false},"callbackData":"test"}}}'; $status = DataConnectionProfileClient::unserializeRoamingStatus($string); assert($status->terminalRoamingStatus->extendedData->destinationAddress == '38598123456'); assert($status->callbackData == "test");