Read List (get)
<?php
//example PHP code to get a list
//set values of list to get
$url_params['apiKey']="APIKEY_HERE";
$url_params['id']="LISTID_HERE";
$url = 'http://apidomain.com/api8/list';
$url = sprintf("%s?%s", $url, http_build_query($url_params));
//Uses CURL, GET Request
$curl = curl_init($url);
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
echo $result;
//Parse the json to get return values.
$parsed_result = json_decode($result,false);
echo "<br><br>Status: $parsed_result->status";
echo "<br>Message: $parsed_result->message";
echo "<br>Error Code: $parsed_result->errorcode";
echo "<br>Error Message: $parsed_result->errormessage";
echo "<br>List Id: ";
echo $parsed_result->data->id;
echo "<br>List Name: ";
echo $parsed_result->data->listname;
echo "<br>List Description: ";
echo $parsed_result->data->description;
?>
Comments
0 comments
Article is closed for comments.