Back to Documentation Overview
listBatchSubscribe
public static listBatchSubscribe(string uid, string id, array batch, boolean double_optin, boolean update_existing, boolean replace_interests)
Subscribe a batch of email addresses to a list at once
- Section:
- List Related
- Parameters:
uid the id for your user account. Get by calling login($user, $pass) id the list id to connect to batch an array of structs for each address to import with two special keys: "EMAIL" for the email address, and "EMAIL_TYPE" for the email type option (html or text) double_optin flag to control whether to send an opt-in confirmation email - defaults to true update_existing flag to control whether to update members that are already subscribed to the list or to return an error, defaults to false (return error) replace_interests flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true) - Returns:
- struct - Array of result counts and any errors that occurred
- Returned Fields:
integer success_count Number of email addresses that were succesfully added/updated integer error_count Number of email addresses that failed during addition/updating array errors Array of error structs. Each error struct will contain "code", "message", and the full struct that failed - <?php
- /**
- This Example shows how to use the XML-RPC service to Batch Subscribe many emails
- to each of your Lists and do some basic error checking.
- Note that we are using the PEAR XML-RPC client and recommend others do as well.
- Realize that these emails are bogus and being generated - you should not do that.
- **/
- require_once 'XML/RPC2/Client.php';
- include('inc/config.inc.php'); //contains username & password
- $uuid = $client->login($username,$password);
- $lists = $client->lists($uuid);
- foreach ($lists as $list){
- for($i = 0; $i < 2000; $i++){
- }
- try {
- /**
- Note that there is a limit to the number of addresses that can be batch subscribed.
- Here we are using 2000, which should be fine. We recommend you not attempt to add
- more than 5000-10,000 addresses per call to listBatchSubscribe()
- */
- $result = $client->listBatchSubscribe($uuid, $list['id'], $batch, false, false, false);
- } catch (XML_RPC2_FaultException $e){
- }
- }
- ?>
Examples (1)
download example code[1] xml-rpc_listBatchSubscribe.php
|
Add New Note
User Contributed Notes for
listBatchSubscribe |
|---|
| Anders Heie : http://www.kadonk.com : listpope -at- cox -dot- net 2008-06-18 06:27:23 Example Language: csharp |
| The documentation confused me a little at first, so here is what I realized:
replace_interests = true: ALL interests provided in call replace all existing interests. replace_interests = false: Interests provided in call are ADDED to existing interests. Also note, that the merges[i].name should be set to the .tag. while the LAST merge is used for interests, and so merges[last].name = .name. Hopefully that will help others. |
| Torsten Muller : http://midwestweekends.com : diwadidu -at- yahoo -dot- com 2008-06-15 07:47:42 Example Language: php |
|
The name of the array element that holds the returned data that could not be processed is "row", like this:
|