<?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 newsletter id
// Hash array with variant props.
$props = array(
"test_duration" => "30", /* the duration which we wait after the test was sent in order to pick a winner. value is specified in minutes. required */
"winner_method" => "open", /* the winner detection method. Can be: open, click, manual. open for open rate, click for click rate, manual for manual selection. required */
"test_group_size" => "50" /* the size (percent) of the test group. required */
);
try {
$client = new Newsman_Client($newsman_user_id, $api_key);
$ret = $client->abtest->setTestProps($newsletter_id, $props);
} catch (Exception $e) {
//do something with the error, eg: log $e->getMessage()
}
return $ret;
?>