<?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";
$newsletter_id = "40001"; // The id of the newsletter for which we want to return the properties
//Array of segments (one int per array item)
$segment_ids = array(
segment_ids[0] => "30011",
segment_ids[1] => "30012"
);
try {
$client = new Newsman_Client($newsman_user_id, $api_key);
$ret = $client->newsletter->setSegments($newsletter_id, $segment_ids);
} catch (Exception $e) {
//do something with the error, eg: log $e->getMessage()
}
return $ret;
?>