示例#1
0
**/
require_once 'inc/BMEAPI.class.php';
require_once 'inc/config.php';
//contains username & password
//This hack actually skips the login and lets you choose the API Key to expire.
$api = new BMEAPI($username, $password, $apiURL);
if ($api->errorCode) {
    // an error occurred while logging in
    echo "code:" . $api->errorCode . "\n";
    echo "msg :" . $api->errorMessage . "\n";
    die;
}
/**
		Fetch the latest contact list ID, so we can retrieve the target contact list ID.
	**/
$contactList = $api->listGet("", 1, 1, "", "");
$listID = $contactList[0]['id'];
/**
	Fetch the latest webhook, so we can retrieve the webhook ID.
	**/
$webhookList = $api->webhookGet($listID);
$webhookID = $webhookList[0]['id'];
$webhookDetails["id"] = $webhookID;
$webhookDetails["contact_list_id"] = $listID;
$webhookDetails["subscribes"] = "false";
$webhookDetails["unsubscribes"] = "false";
$webhookDetails["profile_updates"] = "false";
$webhookDetails["email_changed"] = "false";
$webhookDetails["cleaned_address"] = "false";
$webhookDetails["url"] = 'http://www.webhook-url.com';
$retval = $api->webhookUpdate($webhookDetails);
示例#2
0
=======
<?php 
/**
Get the segments in your account.
**/
require_once 'inc/BMEAPI.class.php';
require_once 'inc/config.php';
//contains username & password
$api = new BMEAPI($username, $password, $apiURL);
if ($api->errorCode) {
    // an error occurred while logging in
    echo "code:" . $api->errorCode . "\n";
    echo "msg :" . $api->errorMessage . "\n";
    die;
}
$retval = $api->listGet("", 1, 1, "", "");
foreach ($retval as $listData) {
    $listID = $listData['id'];
}
$segmentDetail["segmentname"] = "segment";
$segmentDetail["description"] = "test api";
$segmentDetail["listid"] = $listID;
$retval = $api->segmentCreate($segmentDetail);
if (!$retval) {
    echo "Error!";
    echo "\n\tCode=" . $api->errorCode;
    echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
    echo sizeof($retval) . " Segment Created \n" . $retVal;
}
?>
示例#3
0
<?php 
/**
This Example shows how to get the list of existing Emails
**/
require_once 'inc/BMEAPI.class.php';
require_once 'inc/config.php';
//contains username & password
//This hack actually skips the login and lets you choose the API Key to expire.
$api = new BMEAPI($username, $password, $apiURL);
if ($api->errorCode) {
    // an error occurred while logging in
    echo "code:" . $api->errorCode . "\n";
    echo "msg :" . $api->errorMessage . "\n";
    die;
}
$contactList = $api->listGet($token, "", 1, 1, "", "");
$listID = $contactList[0]['id'];
$retval = $api->webhookGet($listID);
if (!$retval) {
    echo "Error!";
    echo "\n\tCode=" . $api->errorCode;
    echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
    echo sizeof($retval) . " Webhooks Returned:\n";
    echo "<table border='1'>";
    echo "<tr>";
    echo "<td>WebhookID</td><td>URL</td><td>subscribes</td><td>unsubscribes</td><td>profile_updates</td><td>cleaned_address</td><td>email_changed</td><td>Created Date</td><td>Modified Date</td>";
    echo "</tr>";
    foreach ($retval as $webhookData) {
        echo "<tr>";
        echo "<td>" . $webhookData['id'] . "</td><td>" . $webhookData['url'] . "</td><td>" . $webhookData['subscribes'] . "</td><td>" . $webhookData['unsubscribes'] . "</td><td>" . $webhookData['profile_updates'] . "</td><td>" . $webhookData['cleaned_address'] . "</td><td>" . $webhookData['email_changed'] . "</td><td>" . $webhookData['modifiedDate'] . "</td><td>" . $webhookData['createdDate'] . "</td>";
示例#4
0
<?php 
/**
Get the contacts from the contact list.
**/
require_once 'inc/BMEAPI.class.php';
require_once 'inc/config.php';
//contains username & password
$api = new BMEAPI($username, $password, $apiURL);
if ($api->errorCode) {
    // an error occurred while logging in
    echo "code:" . $api->errorCode . "\n";
    echo "msg :" . $api->errorMessage . "\n";
    die;
}
//Type may be one of following(Optin,NotOptedIn,ConfirmedBounces,Active,Unsubscribe)
$list = $api->listGet("", 1, 1, "", "");
$contactListID = $list[0]['id'];
$Type = "Optin";
$retval = $api->listGetContactsByType($contactListID, "", 1, 5, "", "", $Type);
if (!$retval) {
    echo "Error!";
    echo "\n\tCode=" . $api->errorCode;
    echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
    echo sizeof($retval) . " Contacts Returned:\n";
    echo "<table>";
    echo "<tr><td>  </td><td>List ID</td><td> Email </td><td> First Name </td>";
    echo "<td> Middle Name</td> <td> Last Name</td></tr>";
    foreach ($retval as $listData) {
        echo "<tr>";
        echo "<td>" . $listData['sequence'] . "</td><td>" . $listData['id'] . "</td>";