PHP code example of acrnogor / flowroute-sdk-v3-php
1. Go to this page and download the library: Download acrnogor/flowroute-sdk-v3-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
acrnogor / flowroute-sdk-v3-php example snippets
function listE911s($client)
{
$limit = 10;
$offset = 0;
$state = NULL;
$return_list = array();
// User the E911 Controller from our Client
$controller = $client->getE911s();
do
{
$e911_data = $controller->listE911s($limit, $offset, $state);
// Iterate through each number item
foreach ($e911_data as $entry)
{
foreach ($entry as $item) {
echo "---------------------------\nE911 Records:\n";
var_dump($item);
$return_list[] = $item;
}
}
// See if there is more data to process
$links = $e911_data->links;
if (isset($links->next))
{
// more data to pull
$offset += $limit;
}
else
{
break; // no more data
}
} while (true);
return $return_list;
}
// List E911 Record Details
echo "--List detail information for an E911 Record\n";
$detail_id = $e911_list[0]->id;
$detail_record = $client->getE911s()->get_e911_details($detail_id);
var_dump($detail_record);
// Associate an E911 Address with a DID
echo "Associate an E911 Address with a DID\n";
$our_numbers = $client->getNumbers()->getAccountPhoneNumbers();
$did_id = $our_numbers->data[0]->id;
echo "Did id " . $did_id . "\n";
$result = $client->getE911s()->associate_did($did_id, $detail_id);
var_dump($result);
Un-associate an E911 Address from a DID
echo "Un-associate an E911 Address from a DID\n";
$result = $client->getE911s()->unassociate_did($did_id);
var_dump($result);
// Delete an E911 Address
echo "Delete an E911 Address\n";
$result = $client->getE911s()->delete_address($detail_id);
var_dump($result);
function GetCNAMs($client, $is_approved=False, $startsWith=NULL,
$endsWith=NULL, $contains=NULL, $limit=10, $offset=0)
{
$return_list = array();
// User the CNAM Controller from our Client
$cnams = $client->getCNAMS();
do
{
$cnam_data = $cnams->listCNAMs($limit, $offset, $is_approved,
$startsWith, $contains, $endsWith);
// Iterate through each number item
foreach ($cnam_data as $entry)
{
foreach ($entry as $item) {
echo "---------------------------\nCNAM Records:\n";
var_dump($item);
$return_list[] = $item;
}
}
// See if there is more data to process
$links = $cnam_data->links;
if (isset($links->next))
{
// more data to pull
$offset += $limit;
}
else
{
break; // no more data
}
} while (true);
return $return_list;
}
echo "Listing only Approved CNAM Records";
// List approved CNAM records
$our_cnams = GetCNAMs($client, True);
if (count($our_cnams) == 0)
{
echo "No currently approved CNAM records. This is as far as the demo can run until you have some records ready for use.";
exit();
}