<?php require_once '../oneapi/client.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 require_once '../oneapi/client.php'; define(FILE_NAME, '../hlr-' . mktime(true)); # example:on-roaming-status $result = DataConnectionProfileClient::unserializeRoamingStatus(); // Process $result here, e.g. just save it to a file: $f = fopen(FILE_NAME, 'w'); fwrite($f, "\n-------------------------------------\n"); fwrite($f, 'callbackData: ' . $result->callbackData . "\n"); fwrite($f, 'servingMccMnc: ' . $result->terminalRoamingStatus->servingMccMnc . "\n"); fwrite($f, 'address: ' . $result->terminalRoamingStatus->address . "\n"); fwrite($f, 'currentRoaming: ' . $result->terminalRoamingStatus->currentRoaming . "\n"); fwrite($f, 'resourceURL: ' . $result->terminalRoamingStatus->resourceURL . "\n"); fwrite($f, 'retrievalStatus: ' . $result->terminalRoamingStatus->retrievalStatus . "\n"); fwrite($f, 'terminalRoamingStatus callbackData: ' . $result->terminalRoamingStatus->callbackData . "\n"); fwrite($f, 'extendedData: ' . $result->terminalRoamingStatus->extendedData . "\n"); fwrite($f, 'IMSI: ', $response->extendedData->imsi, '\\n'); fwrite($f, 'destinationAddres: ', $response->extendedData->destinationAddress, '\\n'); fwrite($f, 'originalNetworkPrefix: ', $response->extendedData->originalNetworkPrefix, '\\n'); fwrite($f, 'portedNetworkPrefix: ', $response->extendedData->portedNetworkPrefix, '\\n'); fwrite($f, "\n-------------------------------------\n"); fclose($f); # ---------------------------------------------------------------------------------------------------- echo 'OK';
<?php require_once '../oneapi/client.php'; $smsClient = new SmsClient(USERNAME, PASSWORD); $smsClient->login(); echo 'smsClient validity is ', $smsClient->isValid() ? 'true' : 'false', "\n"; $dataConnectionProfileClient = new DataConnectionProfileClient(USERNAME, 'wrongpassword'); $dataConnectionProfileClient->login(); echo 'dataConnectionProfileClient validity is ', $dataConnectionProfileClient->isValid() ? 'true' : 'false', "\n"; assert(true === $smsClient->isValid()); assert(false === $dataConnectionProfileClient->isValid());
<?php require_once '../oneapi/client.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 #require_once 'yapd/dbg.php'; 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; }
<? require_once 'oneapi/client.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");