summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/libraries/xmlrpc.rst
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src/source/libraries/xmlrpc.rst')
-rw-r--r--user_guide_src/source/libraries/xmlrpc.rst191
1 files changed, 115 insertions, 76 deletions
diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst
index d2d695ee3..2cf548750 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
+
+ <div class="custom-index container"></div>
+
****************
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 <http://www.xmlrpc.com/>`_ site.
+For detailed specifications, you can visit the `XML-RPC <http://www.xmlrpc.com/>`_ 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,142 @@ 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 <http://www.xmlrpc.com/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
+ :rtype: 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
+ :rtype: 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::
+ Basic HTTP authentication is also supported, simply add it to the server URL::
- $request = array(array('My Photoblog', 'string'), 'http://www.yoursite.com/photoblog/');
- $this->xmlrpc->request($request);
+ $this->xmlrpc->server('http://user:pass@localhost/', 80);
-$this->xmlrpc->send_request()
-==============================
+ .. method:: timeout($seconds = 5)
-The request sending function. Returns boolean TRUE or FALSE based on
-success for failure, enabling it to be used conditionally.
+ :param int $seconds: Timeout in seconds
+ :rtype: void
-$this->xmlrpc->set_debug(TRUE);
-================================
+ Set a time out period (in seconds) after which the request will be canceled::
-Enables debugging, which will display a variety of information and error
-data helpful during development.
+ $this->xmlrpc->timeout(6);
-$this->xmlrpc->display_error()
-===============================
+ .. method:: method($function)
-Returns an error message as a string if your request failed for some
-reason.
+ :param string $function: Method name
+ :rtype: void
-::
+ Sets the method that will be requested from the XML-RPC server::
- echo $this->xmlrpc->display_error();
+ $this->xmlrpc->method('method');
-$this->xmlrpc->display_response()
-==================================
+ Where method is the name of the method.
-Returns the response from the remote server once request is received.
-The response will typically be an associative array.
+ .. method:: request($incoming)
-::
+ :param array $incoming: Request data
+ :rtype: void
- $this->xmlrpc->display_response();
+ Takes an array of data and builds request to be sent to XML-RPC server::
-$this->xmlrpc->send_error_message()
-=====================================
+ $request = array(array('My Photoblog', 'string'), 'http://www.yoursite.com/photoblog/');
+ $this->xmlrpc->request($request);
-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.
+ .. method:: send_request()
-::
+ :returns: TRUE on success, FALSE on failure
+ :rtype: bool
- return $this->xmlrpc->send_error_message('123', 'Requested data not available');
+ The request sending method. Returns boolean TRUE or FALSE based on success for failure, enabling it to be used conditionally.
-$this->xmlrpc->send_response()
-===============================
+ .. method set_debug($flag = TRUE)
-Lets you send the response from your server to the client. An array of
-valid data values must be sent with this method.
+ :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.
- $response = array(
- array(
- 'flerror' => array(FALSE, 'boolean'),
- 'message' => "Thanks for the ping!"
- )
- 'struct');
- return $this->xmlrpc->send_response($response);
+ .. method:: display_error()
-Data Types
-==========
+ :returns: Error message string
+ :rtype: string
-According to the `XML-RPC spec <http://www.xmlrpc.com/spec>`_ there are
-seven types of values that you can send via XML-RPC:
+ Returns an error message as a string if your request failed for some reason.
+ ::
-- *int* or *i4*
-- *boolean*
-- *string*
-- *double*
-- *dateTime.iso8601*
-- *base64*
-- *struct* (contains array of values)
-- *array* (contains array of values)
+ echo $this->xmlrpc->display_error();
+ .. method:: display_response()
+
+ :returns: Response
+ :rtype: 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: 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.
+ ::
+
+ return $this->xmlrpc->send_error_message(123, 'Requested data not available');
+
+ .. method send_response($response)
+
+ :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.
+ ::
+
+ $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