Send Email Message (post)

Send Email Message (post) | Send an email message to list(s).
<?php
//example PHP code to send an email message
//set values of email message to send
$post_params['apiKey']="APIKEY_HERE";
$post_params['messageId']="MESSAGEID_HERE"; //Id of email message to send.
$post_params['sendToListId']="SENDTOLISTID_HERE"; //Id of list to send the message to, or for multiple lists, specify a comma-delimited list of ids.
//Optional fields commented out below:
//$post_params['doNotSendListId']="DONOTSENDLISTID_HERE"; //Id of list not to send the message to, or for multiple lists, specify a comma-delimited list of ids.
//$post_params['fromid']="FROMID_HERE"; //Id of email address to send email from. Will default to message fromid.
//$post_params['subject']="SUBJECT_HERE"; //The subject of the email being sent. Max length is 500 characters. Will default to message subject.
//$post_params['tracklinks']=true; //Option to track link clicks. Defaults to true.
//$post_params['trackopens']=true; //Option to track email opens. Defaults to true.
//$post_params['displayaswebpage']=true; //Option to add link display as a webpage. Defaults to true.
//$post_params['footerId']="FOOTERID_HERE"; //Id of the footer to use. Uses default footer if no value is passed in.
//$post_params['googleAnalytics']=false; //True value enables Google Analytics™ Link Tracking. Defaults to false.
//$post_params['googleCampaign']=""; //This campaign name will appear in your Google Analytics™ data.  Required if googleAnalytics flag is true, otherwise ignored. Max length is 100 characters.
//$post_params['sendimmediately']=true; //Defaults to true. Will schedule the message to be sent immediately.
//$post_params['senddate']="SENDDATE_HERE"; //Date the message will be scheduled to be sent. Required if sendimmediately flag is false, otherwise ignored.
//$post_params['sendtime']="SENDTIME_HERE"; //Time the message will be scheduled to be sent.  Required if sendimmediately flag is false, otherwise ignored.


$url = 'http://apidomain.com/api2/email/message/send';
 
//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>Job Id: ";
echo $parsed_result->data->id;
echo "<br>Date to Send:";
echo $parsed_result->data->datetosend;
echo "<br>Time to SEnd:";
echo $parsed_result->data->timetosend;
?>