<?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";
try {
$client = new Newsman_Client($newsman_user_id, $api_key);
$ret = $client->download->search(
$list_id,
array(
"subscribe_status" => $subscribe_status, /* 1 for subscribed, 0 for unsubscribed, default: 1 */
"bounce_status" => $bounce_status, /* 1 for bounced, 0 for non bounced, default: 0 */
"reported_spam" => $reported_spam, /* 1 for Yes, 0 for No, default: 0 */
"inactivated_status" => $inactivated_status /* 1 for Yes, 0 for No, default: 0 (usually set for local erros or admin inactivations) */
),
array(
"ips" => $ips, /* array of IPs from where the download is allowed */
"expire_seconds" => $expire_seconds /* number of seconds until the link is valid (after it will expire, 404 ERROR), default: 3600 (1h) */
)
);
} catch (Exception $e) {
//do something with the error, eg: log $e->getMessage()
}
return $ret;
?>