tags:

views:

1692

answers:

3

Need a tutorial or some instruction on how to use the XML-RPC library built in to PHP (version PHP Version 5.2.6) for a XML-RPC client. The server is in Python and works.

Google and php.net are failing me.

Update:

Per phpinfo I have xmlrpc-epi v. 0.51 installed. I visited http://xmlrpc-epi.sourceforge.net/ but the xmlrpc-epi-php examples section on the left showed me sf.net's version of a 404.

Update2:

I'm going to use http://phpxmlrpc.sourceforge.net/ and hopefully that will work out for me.

Update3:

The code at http://phpxmlrpc.sourceforge.net/ was straightforward and I got working.

Not closing the question. If anyone wants to chime in with ultra-simple solutions, that would be great!

+1  A: 

Wordpress has XML-RPC.php file take a look at that.. it might help

dswatik
You're welcome glad I could help
dswatik
+1  A: 

A very simple useage of xmlrpc client, in this example, I use a cURL class, see http://code.anbutu.com/n-342

class xmlrpc_client {
        $this->connection = new curl;
        $this->methods = array();
        if ($autoload) {
            $resp = $this->call('system.listMethods', null);
            $this->methods = $resp;
        }
    }
    public function call($method, $params = null) {
        $post = xmlrpc_encode_request($method, $params);
        return xmlrpc_decode($this->connection->post($this->url, $post));
    }
}
header('Content-Type: text/plain');
$rpc = "http://10.0.0.10/api.php";
$client = new xmlrpc_client($rpc, true);
$client->call('methodname', array());
Stackless
Thanks. I've already implemented using the one in the update2 in the question, but I think your solution would work well.
Christopher Mahan
+1  A: 

I've written a simple Object Oriented wrapper which makes it as easy as:

    require_once('ripcord.php');
    $client = ripcord::xmlrpcClient( $url );
    $score  = $client->method( $argument, $argument2, .. );

See http://code.google.com/p/ripcord/wiki/RipcordClientManual for more information and a download link.

Auke