« Back to Documentation OverviewlistMergeVars – v1.1
listMergeVars(string apikey, string id)
Get the list of merge tags for a given list, including their name, tag, and required setting
| Parameters | xml-rpc_listMergeVars.php| apikey | a valid API Key for your user account. Get by calling Get by visiting your API dashboard |
| id | the list id to connect to. Get by calling lists() |
| Returns | | array |
list of merge tags for the list |
| Returned Fields | string | name | Name of the merge field | char | req | Denotes whether the field is required (Y) or not (N) | string | tag | The merge tag that's used for forms and listSubscribe() and listUpdateMember() |
Examples (1)
download example code
[1] xml-rpc_listMergeVars.php
<?php
/**
This Example shows how retrieve the setup of your Merge Variables for a list
using XML-RPC.
Note that we are using the PEAR XML-RPC client and recommend others do as well.
**/
require_once 'XML/RPC2/Client.php';
require_once 'inc/config.inc.php';
try {
$result = $client->listMergeVars($apikey, $listId);
foreach($result as $i=>$var){
echo "\tTag: ". $var['tag']."\n"; echo "\tName: ". $var['name']."\n"; echo "\tRequired: ". $var['req']."\n";
}
} catch (XML_RPC2_FaultException $e){
echo 'code: '.$e->getFaultCode()."\n"; echo 'msg : '.$e->getFaultString()."\n"; }