<?php
 
//client can de downloaded from https://github.com/Newsman/newsman-api-php
require_once("Newsman/Client.php");
 
// you can get your API KEY, your newsman_user_id and list_id from My account -> API
$newsman_user_id = "your-username";
$api_key = "your-api-key";
$list_id = "your-list-id";
$view_online_html = false; //The view online html content or false if no html present
$text = "the text version"; //The text alternative or false if no text present
 
// Hash array with newsletter props.
$campaign_props = array(
 "encoding" => "utf-8", /* the default encoding of this newsletter (default utf-8). optional */ 
 "subject" => "the newsletter subject", /* The newsletter subject. will be encoding using encoding. required */ 
 "use_best_time" => "true" /* use_best_time - Send to each subscriber at the time they are most active (default false). optional */ 
);
 
try {
	$client = new Newsman_Client($newsman_user_id, $api_key);
	$ret = $client->sms->createCampaign($list_id, $text, $view_online_html, $campaign_props);
} catch (Exception $e) {
	//do something with the error, eg: log $e->getMessage()
}
 
return $ret;
 
?>