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/source/libraries/xmlrpc.rst') 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 From cc042095bcce9856402cc04997f44310074716e0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 3 Jan 2014 17:08:27 +0200 Subject: [ci skip] Some more generic user guide cleanup --- user_guide_src/source/libraries/xmlrpc.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide_src/source/libraries/xmlrpc.rst') diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index c79f8bed9..c89c69c46 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -6,11 +6,11 @@ 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: + :local: .. raw:: html -
+
**************** What is XML-RPC? -- cgit v1.2.3-24-g4f1b From d192953eb39845623811486a28b777b3dda93b5c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 7 Jan 2014 12:16:16 +0200 Subject: Add basic HTTP auth info to the XML-RPC docs --- user_guide_src/source/libraries/xmlrpc.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'user_guide_src/source/libraries/xmlrpc.rst') diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index c89c69c46..91d832ff6 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -476,6 +476,10 @@ Class Reference $this->xmlrpc->server('http://www.sometimes.com/pings.php', 80); + Basic HTTP authentication is also supported, simply add it to the server URL:: + + $this->xmlrpc->server('http://user:pass@localhost/', 80); + .. method:: timeout($seconds = 5) :param int $seconds: timeout in seconds -- cgit v1.2.3-24-g4f1b From 75b3fb26a324c71ff18fa19b2a3caa357f8133ec Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sat, 11 Jan 2014 06:58:43 -0600 Subject: cleanup warnings Signed-off-by: Connor Tumbleson --- user_guide_src/source/libraries/xmlrpc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide_src/source/libraries/xmlrpc.rst') diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index 91d832ff6..53fe965d7 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -551,7 +551,7 @@ Class Reference 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'); + return $this->xmlrpc->send_error_message(123, 'Requested data not available'); .. method send_response($response) -- cgit v1.2.3-24-g4f1b From 28c2c975b118016d07212ed8e7c22ff280309f82 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 8 Feb 2014 04:27:48 +0200 Subject: [ci skip] Add return types to library docs --- user_guide_src/source/libraries/xmlrpc.rst | 53 ++++++++++++++++-------------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'user_guide_src/source/libraries/xmlrpc.rst') diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index d9b2dfb1a..2cf548750 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -459,18 +459,18 @@ Class Reference .. method:: initialize([$config = array()]) - :param array $config: configuration data - :returns: void + :param array $config: Configuration data + :rtype: void Initializes the XML-RPC library. Accepts an associative array containing your settings. .. method:: server($url[, $port = 80[, $proxy = FALSE[, $proxy_port = 8080]]]) - :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 + :param string $url: XML-RPC server URL + :param int $port: Server port + :param string $proxy: Optional proxy + :param int $proxy_port: Proxy listening port + :rtype: void Sets the URL and port number of the server to which a request is to be sent:: @@ -482,8 +482,8 @@ Class Reference .. method:: timeout($seconds = 5) - :param int $seconds: timeout in seconds - :returns: void + :param int $seconds: Timeout in seconds + :rtype: void Set a time out period (in seconds) after which the request will be canceled:: @@ -491,8 +491,8 @@ Class Reference .. method:: method($function) - :param string $function: method name - :returns: void + :param string $function: Method name + :rtype: void Sets the method that will be requested from the XML-RPC server:: @@ -502,8 +502,8 @@ Class Reference .. method:: request($incoming) - :param array $incoming: request data - :returns: void + :param array $incoming: Request data + :rtype: void Takes an array of data and builds request to be sent to XML-RPC server:: @@ -512,20 +512,22 @@ Class Reference .. method:: send_request() - :returns: bool + :returns: TRUE on success, FALSE on failure + :rtype: bool 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) - :param bool $flag: debug status flag - :returns: void + :param bool $flag: Debug status flag + :rtype: void Enables or disables debugging, which will display a variety of information and error data helpful during development. .. method:: display_error() - :returns: string + :returns: Error message string + :rtype: string Returns an error message as a string if your request failed for some reason. :: @@ -534,7 +536,8 @@ Class Reference .. method:: display_response() - :returns: mixed + :returns: Response + :rtype: mixed Returns the response from the remote server once request is received. The response will typically be an associative array. :: @@ -543,9 +546,10 @@ Class Reference .. method:: send_error_message($number, $message) - :param int $number: error number - :param string $message: error message - :returns: object + :param int $number: Error number + :param string $message: Error message + :returns: XML_RPC_Response instance + :rtype: XML_RPC_Response 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. @@ -555,8 +559,9 @@ Class Reference .. method send_response($response) - :param array $response: response data - :returns: object + :param array $response: Response data + :returns: XML_RPC_Response instance + :rtype: XML_RPC_Response Lets you send the response from your server to the client. An array of valid data values must be sent with this method. :: @@ -569,4 +574,4 @@ Class Reference 'struct' ); - return $this->xmlrpc->send_response($response); + return $this->xmlrpc->send_response($response); \ No newline at end of file -- cgit v1.2.3-24-g4f1b