Update List (put)

Update List (put) | Update an existing list.
<?php
//example PHP code to update a list
//set values of list to update
$put_params['apiKey']="APIKEY_HERE";
$put_params['id']="LISTID_HERE";
$put_params['listname']="LISTNAME_HERE";
//Optional fields commented out below:
//$put_params['folderid']="0"; //Id of folder. Defaults to 0 (main folder).
//$put_params['description']="DESCRIPTION_HERE";
//$put_params['subscribercenterflag']="0"; //0=true, 1=false. Defaults to 0
//$put_params['position']="0"; //Position of list. Defaults to 0.

$url = 'http://apidomain.com/api2/list';

//Puts this using CURL
$curl = curl_init($url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); 
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($curl, CURLOPT_POSTFIELDS,http_build_query($put_params));

$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;
?>