Create List (post)

Create List (post) | Add a new list.
<?php
//example PHP code to add a list
//set values of list to insert
$post_params['apiKey']="APIKEY_HERE";
$post_params['listname']="LISTNAME_HERE";
$post_params['listtype']="2"; //Type of list. 1=SMS List, 2=Email List. Defaults to 2.
//Optional fields commented out below:
//$post_params['folderid']="0"; //Id of folder. Defaults to 0 (main folder).
//$post_params['description']="DESCRIPTION_HERE";
//$post_params['subscribercenterflag']="0"; //0=true, 1=false. Defaults to 0
//$post_params['position']="0"; //Position of list. Defaults to 0.

$url = 'http://apidomain.com/api2/list';
 
//Posts this using CURL
$curl = curl_init($url);
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, $post_params);
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;
?>