It’s only a few days before Christmas, and things are moving at a pace faster than I would like.

Nevertheless, I managed to slip in a bit of time to produce yet another CCB API Tutorial.

In this week’s edition, I’m sharing how to access and retrieve a list of mobile carriers via the CCB API’s mobile_carrier_list.

Today’s tutorial is rather straight forward so I won’t dive in the proverbial technical weeds with in-depth explanations.

In the coming week(s) though, we’ll build and expand this tutorial to offer manual text messaging capabilities via the web browser.

But for today, we’ll focus on creating the mobile_carrier_list api call and it’s response data.

To learn more about the mobile_carrrier_list API service, please refer to CCB API Documentation.

The code below allows for retrieving a list of carriers and displaying the list of mobile carriers in a drop down menu, also referred to as a select menu.

When executing the code below, you should view the following in your web browser:

<?PHP

// contains resusable globals and functions
include("includes/config.php");


$apiService = 'mobile_carrier_list'; // CCB api service

$urlData = array_filter( array(
	'srv' => "$apiService"
	) );

$rss = ccbDetails('get',$urlData); // transform to XML

$nodes = $rss->xpath('//mobile_carriers/mobile_carrier');  // xpath for mobile_carriers/mobile_carrier

$response_object = '<select name="'.$apiService.'" id="'.$apiService.'">';

$response_object .= '<option value="#">Select One</option>';

foreach ($nodes as $node)
{
    $response_object .= '<option value="'.$node->email.'">'.$node->name.' ('.$node->email.')</option>';  // now print the item name and it (See CCB API documentation for more $apiService fields)
}

$response_object .= '</select>';


?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mobile Carrier Drop</title>
</head>

<body>
<? echo $response_object; ?>
</body>

</html>

Please don’t hesitate to leave questions or comments should you need technical assistance.

And last but not least, I want to wish each of your a Merry Christmas and a Happy New Year (should I not get to release another tutorial prior to New Year’s).

Related Posts

Subscribe and receive the following...

  • Inside CCB tips and tricks
  • Instant CCB tutorial alerts and updates
  • CCB How To's, Videos, Webinars and more...