Support (Previous) (Next) API

Last updated: Sun, 16 May 2004

Examples

Examples -- Usage examples for the XML_RPC package

XML-RPC client: state name query

Code to get the corresponding state name from a number (1-50) from Dave Winer's server.


<?php
require_once "XML/RPC.php";

/**
 * Get the name of state 42 (Tenesse)
 */
$params = array(new XML_RPC_Value(42, "int"));
$msg = new XML_RPC_Message("examples.getStateName", $params);

$client = new XML_RPC_Client("/RPC2", "betty.userland.com", 80);

$response = $client->send($msg);

$v = $response->value();

if (!$response->faultCode()) {
    print "State number 42 is " . $v->scalarval() . "\n";
    print "I got this value back:\n" . $response->serialize() . "\n";
} else {
    print "Fault: ";
    print "Code: " . $response->faultCode() . " Reason '" . $response->faultString() . "'\n";
}
?>

Support (Previous) (Next) API

Download Documentation Last updated: Sun, 16 May 2004
Hosting
HIVE: All information for read only. Please respect copyright!
Hosted by hive ÊÃÁ: Êèåâñêàÿ ãîðîäñêàÿ áèáëèîòåêà