This method is used to return your contact lists.
Parameters:<?xml version='1.0'?> <request> <version>0.3</version> <key>API_KEY</key> <secret>API_SECRET</secret> <method>contact-lists.get</method> <params> <offset>0</offset> <limit>10</limit> </params> </request>
<?xml version='1.0'?> <xml> <method>contact-lists.get</method> <total>1</total> <time>2009-12-11 02:47:22 GMT</time> <timestamp>1260499642 GMT</timestamp> <dataset> <data> <id>1</id> <name>My SMS List</name> <recipient_count>3</recipient_count> </data> </dataset> </xml>
<?php
// change api key and secret to your own
$myAPIKey = "API_KEY";
$myAPISecret = "API_SECRET";
// include base class
require('APIclient.php');
// create new client object
$transmitsmsAPI = new transmitsmsAPI($myAPIKey, $myAPISecret);
// set parameters
$offset = 0;
$limit = 10;
// execute request
$methodResponse = $transmitsmsAPI->getContactLists($offset, $limit);
// parse response into xml object
$xml = @simplexml_load_string($methodResponse);
// problem with request
if (! $xml) {
exit(date("y-m-d H:i:s") . " - Problem with request : " . $methodResponse);
}
// valid response has come back
else {
// view contents of the request in raw dump form
echo "<pre>";
print_r($xml);
echo "</pre>";
/******************************************************************************************
Following examples assume use of the SimpleXML object examples
SimpleXML returns objects so type casting has been used to avoid any type related issues.
******************************************************************************************/
// display method
echo (string) $xml->method . '<br />';
// access id of first dataset child
echo (string) $xml->dataset[0]->data->id . '<br />';
}
?>Using a URL based request system you can request this method by using the below URL - be sure to url encode all your variables!
http://burstsms.com.au/api-wrapper/contact-lists.get?apikey=API_KEY&apisecret=API_SECRET&offset=0&limit=10