Client Documentation

Updated December 12, 2005

Calling the Member service with PHP and the Pear library user Rob Hunter found code from The Atlanta PHP user's group to call the free geocoder service. He added a call to the setCredentials method and created an example of using the member service from PHP with the PEAR (PHP Extension and Application Repository).

Read The original post by Ben Ramsey that discusses installing Pear, and then look at Rob's additional setCredentials line. Also see these notes on the PEAR XML-RPC interface

$address = '1600 Pennsylvania Av, Washington, DC 20502';
$params = array(new XML_RPC_Value($address, 'string'));
$message = new XML_RPC_Message('geocode', $params);
$client = new XML_RPC_Client('/member/service/xmlrpc', '');
$response = $client->send($message);

if (!$response) {
    echo 'Communication error: ' . $client->errstr;
if (!$response->faultCode()) {
    $value = $response->value();
    $address_data = XML_RPC_decode($value);
} else {
    echo 'Fault Code: ' . $response->faultCode() . "\n";
    echo 'Fault Reason: ' . $response->faultString() . "\n";