Back to Documentation Overview

listMergeVars

public static listMergeVars(string apikey, string id)

Get the list of merge tags for a given list, including their name, tag, and required setting

Section:
List Related
Parameters:
apikey a valid API Key for your user account. Get by calling login()
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

  1. <?php
  2. /**
  3. This Example shows how retrieve the setup of your Merge Variables for a list
  4. using XML-RPC.
  5. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  6. **/
  7. require_once 'XML/RPC2/Client.php';
  8. require_once 'inc/config.inc.php';
  9. try {
  10. $client = XML_RPC2_Client::create($apiUrl);
  11.  
  12. $result = $client->listMergeVars($apikey, $listId);
  13. echo "SUCCESS! \n";
  14. foreach($result as $i=>$var){
  15. echo "Var #$i:\n";
  16. echo "\tTag: ". $var['tag']."\n";
  17. echo "\tName: ". $var['name']."\n";
  18. echo "\tRequired: ". $var['req']."\n";
  19.  
  20. }
  21. } catch (XML_RPC2_FaultException $e){
  22. echo "ERROR!!!!\n";
  23. echo 'code: '.$e->getFaultCode()."\n";
  24. echo 'msg : '.$e->getFaultString()."\n";
  25. }
  26. echo "\n";
  27.  
  28.  
Add New Note User Contributed Notes for listMergeVars
No notes, yet... Will you be the first??