Create new list..
listCreate(string $title, array $options) : string
Array of lists. Each list is represented as an array that includes:
<?php /** * This Example shows how to listCreate using the MGAPI.php class and do some basic error checking. */ require_once 'inc/MGAPI.class.php'; require_once 'inc/config.inc.php'; //contains apikey $api = new MGAPI($apikey); $title = 'Test List'; $options = array( 'permission_reminder' =--> 'Write a short reminder about how the recipient joined your list.', 'notify_to' => 'example@example.org', 'subscription_notify' => true, 'unsubscription_notify' => true, 'has_email_type_option' => true, 'public_title' => 'Public Name for Test List', ); $retval = $api->listCreate($title, $options); header("Content-Type: text/plain"); if ($api->errorCode) { echo "Unable to load listCreate()!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { echo "New List ID:" . $retval . "\n"; }
<?php /** * This Example shows how execute a listCreate and check the result using XML-RPC. * Note that we are using the PEAR XML-RPC client and recommend others do as well. */ require_once 'xmlrpc-3.0.0.beta/xmlrpc.inc'; require_once 'inc/config.inc.php'; $apiUrl = parse_url($apiUrl); $v = new xmlrpcval(array( 'apikey' =--> new xmlrpcval($apikey), 'title' => new xmlrpcval('Test List'), 'options' => php_xmlrpc_encode( array( "permission_reminder" => 'Write a short reminder about how the recipient joined your list.', "notify_to" => 'example@example.org', "subscription_notify" => true, "unsubscription_notify" => true, "has_email_type_option" => true ) ) ), 'struct'); $f = new xmlrpcmsg('listCreate', array($v)); $c = new xmlrpc_client($apiUrl["path"], $apiUrl['host'], 80); $c->setDebug($debug); $r = &$c->send($f); header("Content-Type: text/plain"); if (!$r->faultCode()) { $retval = php_xmlrpc_decode($r->value()); echo "Returned: " . $retval . "\n"; } else { echo "Unable to load listCreate()!\n"; echo "\tCode=" . $r->faultCode() . "\n"; echo "\tMsg=" . $r->faultString() . "\n"; }