<?php
/**
This Example shows how add an API Key to your account and then retrieve a list
of all API Keys on your account using XML-RPC.
Note that we are using the PEAR XML-RPC2 client and recommend others do as well.
**/
require_once 'XML/RPC2/Client.php';
require_once 'inc/config.inc.php';
try {
$result = $client->apikeyAdd($username,$password, $apikey);
echo "New API Key = ".$result."\n"; echo "All API Keys for your account:\n"; $result = $client->apikeys($username,$password, $apikey);
foreach($result as $key){
echo "key = ".$key['apikey']."\n"; echo "\tcreated: = ".$key['created_at']."\n"; echo "\texpired : = ".$key['expired_at']."\n"; }
} catch (XML_RPC2_FaultException $e){
echo $e->getFaultCode()." : ".$e->getFaultString()."\n"; }