01 May 2013 - After the site upgrade, all passwords were reset and you will need to ask the site for a login reset on your first connection.
Closing the tour of XML-RPC implementations usable with PHP-GTK, the shortest
code to access our geo_nick service makes use a higher-level XML-RPC library: the
Zend_XmlRpc_Client from the
Zend
Framework.
Unlike earlier implementations, Zend Framework (ZF) includes both the mashalling/unmarshalling to/from XML line format and the HTTP request/reponse process, wrapped up in a class-based mechanism using exceptions to handle errors, both at the HTTP and XML service levels (not demonstrated here).
<?php
if (!class_exists('gtk'))
{
die("Please load the php-gtk2 module in your php.ini\r\n");
}
require_once('Zend/XmlRpc/Client.php');
/**
* Prepare the request data
*/
$host = 'php-gtk.eu';
$port = 80;
$backend = 'xmlrpc.php';
$client = new Zend_XmlRpc_Client("http://$host:$port/$backend");
$res = $client->call('gtkphpnet.geo_nick', '', 10);
/**
* and display them in a PHP-GTK2 window
*/
$window = new GtkWindow();
$window->set_title('php-gtk.eu geo-nick service');
$window->connect_simple('destroy', array('Gtk','main_quit'));
$textBuffer = new GtkTextBuffer();
$textBuffer->set_text(print_r($res, true));
$textView = new GtkTextView();
$textView->set_buffer($textBuffer);
$textView->set_editable(false);
$window->add($textView);
$window->show_all();
Gtk::main();
?>Of interest to PHP-GTK apps using more than one XML-RPC series of service is the notion of a server proxy available in ZF. This allows one to rewrite:
<?php
// ...
$client = new Zend_XmlRpc_Client("http://$host:$port/$backend");
$res = $client->call('gtkphpnet.geo_nick', '', 10);
?>as :
<?php
$client = new Zend_XmlRpc_Client("http://$host:$port/$backend");
$server = $client->getProxy('gtkphpnet');
$res = $server->geo_nick('', 10);
?>...which make XML-RPC calls almost like local calls, a bit like using a full SOAP stack without all the associated overhead.
Recent comments
43 weeks 3 days ago
44 weeks 2 days ago
44 weeks 6 days ago
47 weeks 2 days ago
1 year 15 weeks ago
1 year 19 weeks ago
1 year 23 weeks ago
1 year 23 weeks ago
1 year 23 weeks ago
1 year 40 weeks ago