Below are some examples to get you started. You can download the entire library with examples of all the methods. We have also detailed documentation for every method along with descriptions of the parameters.
<?php
require_once 'XML/RPC2/Client.php';
try
{
$client=XML_RPC2_Client::create("http://api.benchmarkemail.com/1.0/");
$token=$client->login("YOUR BENCHMARK LOGIN", "YOUR BENCHMARK PASSWORD");
}catch (XML_RPC2_FaultException $e){
echo "ERROR:" . $e->getFaultString() ."(" . $e->getFaultCode(). ")";
}
?>
<?php
require_once 'XML/RPC2/Client.php';
try
{
$client=XML_RPC2_Client::create("http://api.benchmarkemail.com/1.0/");
$token=$client->login("YOUR BENCHMARK LOGIN", "YOUR BENCHMARK PASSWORD");
}catch (XML_RPC2_FaultException $e){
echo "ERROR:" . $e->getFaultString() ."(" . $e->getFaultCode(). ")";
}
?>
<?php
require_once 'XML/RPC2/Client.php';
try
{
$client=XML_RPC2_Client::create("http://api.benchmarkemail.com/1.0/");
$token=$client->login("YOUR BENCHMARK LOGIN", "YOUR BENCHMARK PASSWORD");
$listID="999";
$rec1['email']='test1@test.com';
$rec2['email']='test2@test.com';
$rec=array($rec1, $rec2);
$result=$client->listAddContacts($token, $listID, $rec);
}catch (XML_RPC2_FaultException $e){
echo "ERROR:" . $e->getFaultString() ."(" . $e->getFaultCode(). ")";
}
?>
<!--#include file="include/config.asp" -->
<!--#include file="include/xmlrpc.asp" -->
<%
on error resume next
Dim resultList
ParamArr=array(username,password)
token=xmlRPC(ApiURL,"login",ParamArr)
IF faultStringCode=0 THEN
ParamArr=array(token,"",1,100,"","")
resultList=xmlRPC(ApiURL,"listGet",ParamArr)
if faultStringCode=0 then
If (Not IsEmpty(resultList)) Then
Response.Write " <table border='1'>"
Response.Write " <tr>"
Response.Write " <th>sequence </th>"
Response.Write " <th>id </th>"
Response.Write " <th>listname </th>"
Response.Write " <th>contactcount </th>"
Response.Write " <th>createdDate </th>"
Response.Write " <th>modifiedDate </th>"
Response.Write " </tr>"
For i=LBound(resultList) To UBound(resultList)
Response.Write " <tr>"
Response.Write " <td>" & resultList(i)("sequence") & " </td>"
Response.Write " <td>" & resultList(i)("id") & " </td>"
Response.Write " <td>" & resultList(i)("listname") & " </td>"
Response.Write " <td>" & resultList(i)("contactcount") & " </td>"
Response.Write " <td>" & resultList(i)("createdDate") & " </td>"
Response.Write " <td>" & resultList(i)("modifiedDate") & " </td>"
Response.Write " </tr>"
Next
Response.Write " </table>"
End If
else
Response.Write "Error Detail :- " & parseErrorCode(faultStringText & "")
end if
ELSE
Response.Write "Error Detail :- " & parseErrorCode(faultStringText & "")
END IF
if err.Number <> 0 then
Response.Write err.description & " (Error code: " & err.Number & ")"
end if
%>
<!--#include file="include/config.asp" -->
<!--#include file="include/xmlrpc.asp" -->
<%
on error resume next
Dim resultList, parameterArray
ParamArr=array(username,password)
token=xmlRPC(ApiURL,"login",ParamArr)
IF faultStringCode=0 THEN
Dim listName
listName="Api Test File"
ParamArr=array(token,listName)
resultList=xmlRPC(ApiURL,"listCreate",ParamArr)
if faultStringCode=0 then
Response.Write("Total Contacts: " & resultList)
else
Response.Write "Error Detail :- " & parseErrorCode(faultStringText & "")
end if
ELSE
Response.Write "Error Detail:- " & parseErrorCode(faultStringText & "")
END IF
if err.number <>0 then
response.write("Error number: " & err.number & " <P>")
response.write("Error description: " & err.description & " <P>")
end if
%>
<!--#include file="include/config.asp" -->
<!--#include file="include/xmlrpc.asp" -->
<%
on error resume next
Dim dict1, dict2, resultList, parameterArray
ParamArr=array(username,password)
token=xmlRPC(ApiURL,"login",ParamArr)
IF faultStringCode=0 THEN
ParamArr=array(token,"",1,1,"","")
resultList=xmlRPC(ApiURL,"listGet",ParamArr)
Set dict1=Server.CreateObject("scripting.dictionary")
dict1.Add "email","user1@__.com"
dict1.Add "firstname","Peter"
dict1.Add "lastname","Sawant"
Set dict2=Server.CreateObject("scripting.dictionary")
dict2.Add "email","user2@__.com"
dict2.Add "firstname","Bruce"
dict2.Add "lastname","Banner"
parameterArray=array(dict1,dict2)
ParamArr=array(token,resultList(0)("id"),parameterArray)
resultList=xmlRPC(ApiURL,"listAddContacts",ParamArr)
if faultStringCode=0 then
Response.Write("Total Contacts: " & resultList)
else
Response.Write "Error Detail :- " & parseErrorCode(faultStringText & "")
end if
ELSE
Response.Write "Error Detail:- " & parseErrorCode(faultStringText & "")
END IF
if err.number <>0 then
response.write("Error number: " & err.number & " <P>")
response.write("Error description: " & err.description & " <P>")
end if
%>