From d8afb982f10e259142f33f882f6d6032a3ca9b1c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 23 Sep 2013 16:01:46 +0300 Subject: [ci skip] Update XML-RPC library docs --- user_guide_src/source/libraries/xmlrpc.rst | 182 +++++++++++++++++------------ 1 file changed, 106 insertions(+), 76 deletions(-) (limited to 'user_guide_src') diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index a43c48837..c79f8bed9 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -5,6 +5,13 @@ XML-RPC and XML-RPC Server Classes CodeIgniter's XML-RPC classes permit you to send requests to another server, or set up your own XML-RPC server to receive requests. +.. contents:: + :local: + +.. raw:: html + +
+ **************** What is XML-RPC? **************** @@ -24,8 +31,11 @@ it to determine which class/method should be called to process the request. Once processed, the server will then send back a response message. -For detailed specifications, you can visit the -`XML-RPC `_ site. +For detailed specifications, you can visit the `XML-RPC `_ site. + +*********************** +Using the XML-RPC Class +*********************** Initializing the Class ====================== @@ -123,6 +133,7 @@ with the data type in the second position:: The `Data Types <#datatypes>`_ section below has a full list of data types. + Creating an XML-RPC Server ========================== @@ -425,114 +436,133 @@ the Server. $size = $parameters[1]['size']; $shape = $parameters[1]['shape']; -************************** -XML-RPC Function Reference -************************** +Data Types +========== -$this->xmlrpc->server() -======================= +According to the `XML-RPC spec `_ there are +seven types of values that you can send via XML-RPC: -Sets the URL and port number of the server to which a request is to be -sent:: +- *int* or *i4* +- *boolean* +- *string* +- *double* +- *dateTime.iso8601* +- *base64* +- *struct* (contains array of values) +- *array* (contains array of values) - $this->xmlrpc->server('http://www.sometimes.com/pings.php', 80); +*************** +Class Reference +*************** -$this->xmlrpc->timeout() -======================== +.. class:: CI_Xmlrpc -Set a time out period (in seconds) after which the request will be -canceled:: + .. method:: initialize([$config = array()]) - $this->xmlrpc->timeout(6); + :param array $config: configuration data + :returns: void -$this->xmlrpc->method() -======================= + Initializes the XML-RPC library. Accepts an associative array containing your settings. -Sets the method that will be requested from the XML-RPC server:: + .. method:: server($url[, $port = 80[, $proxy = FALSE[, $proxy_port = 8080]]]) - $this->xmlrpc->method('method'); + :param string $url: XML-RPC server URL + :param int $port: server port + :param string $proxy: optional proxy + :param int $proxy_port: proxy listening port + :returns: void -Where method is the name of the method. + Sets the URL and port number of the server to which a request is to be sent:: -$this->xmlrpc->request() -======================== + $this->xmlrpc->server('http://www.sometimes.com/pings.php', 80); -Takes an array of data and builds request to be sent to XML-RPC server:: + .. method:: timeout($seconds = 5) - $request = array(array('My Photoblog', 'string'), 'http://www.yoursite.com/photoblog/'); - $this->xmlrpc->request($request); + :param int $seconds: timeout in seconds + :returns: void -$this->xmlrpc->send_request() -============================== + Set a time out period (in seconds) after which the request will be canceled:: -The request sending function. Returns boolean TRUE or FALSE based on -success for failure, enabling it to be used conditionally. + $this->xmlrpc->timeout(6); -$this->xmlrpc->set_debug(TRUE); -================================ + .. method:: method($function) -Enables debugging, which will display a variety of information and error -data helpful during development. + :param string $function: method name + :returns: void -$this->xmlrpc->display_error() -=============================== + Sets the method that will be requested from the XML-RPC server:: -Returns an error message as a string if your request failed for some -reason. + $this->xmlrpc->method('method'); -:: + Where method is the name of the method. - echo $this->xmlrpc->display_error(); + .. method:: request($incoming) -$this->xmlrpc->display_response() -================================== + :param array $incoming: request data + :returns: void -Returns the response from the remote server once request is received. -The response will typically be an associative array. + Takes an array of data and builds request to be sent to XML-RPC server:: -:: + $request = array(array('My Photoblog', 'string'), 'http://www.yoursite.com/photoblog/'); + $this->xmlrpc->request($request); - $this->xmlrpc->display_response(); + .. method:: send_request() -$this->xmlrpc->send_error_message() -===================================== + :returns: bool -This function lets you send an error message from your server to the -client. First parameter is the error number while the second parameter -is the error message. + The request sending method. Returns boolean TRUE or FALSE based on success for failure, enabling it to be used conditionally. -:: + .. method set_debug($flag = TRUE) - return $this->xmlrpc->send_error_message('123', 'Requested data not available'); + :param bool $flag: debug status flag + :returns: void -$this->xmlrpc->send_response() -=============================== + Enables or disables debugging, which will display a variety of information and error data helpful during development. -Lets you send the response from your server to the client. An array of -valid data values must be sent with this method. + .. method:: display_error() -:: + :returns: string - $response = array( - array( - 'flerror' => array(FALSE, 'boolean'), - 'message' => "Thanks for the ping!" - ) - 'struct'); - return $this->xmlrpc->send_response($response); + Returns an error message as a string if your request failed for some reason. + :: -Data Types -========== + echo $this->xmlrpc->display_error(); -According to the `XML-RPC spec `_ there are -seven types of values that you can send via XML-RPC: + .. method:: display_response() -- *int* or *i4* -- *boolean* -- *string* -- *double* -- *dateTime.iso8601* -- *base64* -- *struct* (contains array of values) -- *array* (contains array of values) + :returns: mixed + + Returns the response from the remote server once request is received. The response will typically be an associative array. + :: + + $this->xmlrpc->display_response(); + + .. method:: send_error_message($number, $message) + + :param int $number: error number + :param string $message: error message + :returns: object + This method lets you send an error message from your server to the client. + First parameter is the error number while the second parameter is the error message. + :: + + return $this->xmlrpc->send_error_message(123, 'Requested data not available'); + + .. method send_response($response) + + :param array $response: response data + :returns: object + + Lets you send the response from your server to the client. An array of valid data values must be sent with this method. + :: + + $response = array( + array( + 'flerror' => array(FALSE, 'boolean'), + 'message' => "Thanks for the ping!" + ), + 'struct' + ); + + return $this->xmlrpc->send_response($response); \ No newline at end of file -- cgit v1.2.3-24-g4f1b