SMS Send (post)

SMS Send (post) | Send a SMS message.
<?php
//example PHP code to send a sms message
//set values for sms
$post_params['apiKey']="APIKEY_HERE";
$post_params['from']="1234567890"; //Sender FROM number - This must be a valid 10 digit phone number that is active for the account associated with the apiKey.
$post_params['to']="1234567890"; //Mobile number(s) to send the SMS message to. This must be valid 10 digit mobile number(s). For multiple numbers, specify a comma-delimited list.
$post_params['message']="MESSAGE_HERE"; //Message to send.
//Optional fields commented out below:
//$post_params['truncate']="true"; //If true, truncates the message at 160 characters. If false, breaks up and sends the message as multiple 160 character messages.
//$post_params['tracklinks']="false"; //Option to track link clicks. Defaults to false.

$url = 'http://apidomain.com/api2/sms/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";
 
?>