Oleh: kod34fr33 | 6/Juni/2007

CakePHP XMLRPC Client component

this is my cakephp XMLRPC client component that i used on my last project.
*I still have trouble with code snippet with wordpress. then i cant exposed here. just download from link above*
original file name : xml_client.php

usage:
1. set host, port and param with these method:
[a] Set it on class variable initiation

     var $host = "SET HOST HERE";
     var $port = "SET PORT HERE;
     var $path = "SET PATH HERE";

[b] Set it with setter method from controller:

     $this-XmlClient->set_host("SET HOST HERE");
     $this->XmlClient->set_port("SET PORT HERE");
     $this->XmlClient->set_path("SET PATH HERE");

2. do xmlrpc client

     $response = $this->XmlClient->do_call("function method",array(parameter,parameter,...));

note:
[1] $response from do_call function is in array form (not xml form). if you want the raw response (which http header still available), you can get from

$rawresponse = $this->XmlClient->rawResponse

.

[2] To detect wether response was fault response, you can check with

$this->XmlClient->is_fault_response();

and, you can fetch fault string (“FAULT STRING BLA BLA BLA (err code: FAULT CODE)”) with this method

 $fault_string = $this->XmlClient->get_fault_string();

[3] this component only works for http 1/1 protocol.
[4] this component need php’s xmlrpc extensions (–with-xmlrpc)

thats all.
any comment?


Tanggapan

  1. it says…

    Fatal error: Call to undefined method XmlClientComponent::set_param() in

  2. rdeman:
    yes, you right.
    i forgot to delete line

    “$this->set_param();”

    below line

    function do_call() {

    you could delete that line and try again, or download the new one (from the same link above). :)

    thx a lot.


Beri tanggapan

Your response:

Kategori