Skip to Main Content
PHP 5 Kochbuch, Third Edition
book

PHP 5 Kochbuch, Third Edition

by David Sklar, Adam Trachtenberg, Carsten Lucke, Matthias Brusdeylins, Ulrich Speidel, Stephan Schmidt
September 2009
Intermediate to advanced content levelIntermediate to advanced
912 pages
48h 11m
German
O'Reilly Verlag
Content preview from PHP 5 Kochbuch, Third Edition

15.2 XML-RPC-Anfragen empfangen

Problem

Sie möchten einen XML-RPC-Server aufbauen und auf XML-RPC-Anfragen antworten. Auf diese Weise können XML-RPC-fähige Clients Ihrem Server Fragen stellen, und Sie können mit Daten antworten.

Lösung

Verwenden Sie das PEAR-Paket XML_RPC, das eine Klasse zum Erstellen von XML-RPC-Servern zur Verfügung stellt.

require_once 'XML/RPC/Server.php';

// Dies ist die als "get_time()" offen gelegte Funktion.
function return_time($args)
{
   $date = date('Ymd\THis');
   $val  = new XML_RPC_Value($date);
   $response = new XML_RPC_Response($val);
   return $response;
}
$map = array(
              'getTime' => array(
                                 'function' => 'return_time'
                               )
           );
$server = new XML_RPC_Server($map);

Diskussion

Das PEAR-Paket XML_RPC bietet neben Klassen für das Erstellen ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP programmieren unter Windows

PHP programmieren unter Windows

Arno Hollosi
CSS Kochbuch, 3rd Edition

CSS Kochbuch, 3rd Edition

Joergen Lang, Christopher Schmitt

Publisher Resources

ISBN: 9783868993271Purchase book