blob: 24d0f4e62673b9e4b0c8563e9f29426057b016bd [file] [log] [blame]
Andrey Andreevc5769952019-01-16 17:49:35 +02001
2
3<!DOCTYPE html>
4<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
5<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
6<head>
7 <meta charset="utf-8">
8 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
10 <title>XML-RPC and XML-RPC Server Classes &mdash; CodeIgniter 3.1.10 documentation</title>
11
12
13
14
15 <link rel="shortcut icon" href="../_static/ci-icon.ico"/>
16
17
18
19 <link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
20
21
22
23
24
25
26
27
28
29 <link rel="stylesheet" href="../_static/css/citheme.css" type="text/css" />
30
31
32
33 <link rel="index" title="Index"
34 href="../genindex.html"/>
35 <link rel="search" title="Search" href="../search.html"/>
36 <link rel="top" title="CodeIgniter 3.1.10 documentation" href="../index.html"/>
37 <link rel="up" title="Libraries" href="index.html"/>
38 <link rel="next" title="Zip Encoding Class" href="zip.html"/>
39 <link rel="prev" title="User Agent Class" href="user_agent.html"/>
40
41
42 <script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
43
44</head>
45
46<body class="wy-body-for-nav" role="document">
47
48 <div id="nav">
49 <div id="nav_inner">
50
51
52
53 <div id="pulldown-menu" class="ciNav">
54 <ul>
55<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
56</ul>
57<ul>
58<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
59<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
60<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
61<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
62<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
63</ul>
64</li>
65</ul>
66<ul>
67<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
68<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
69<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
70<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
71<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
72<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
73<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
74</ul>
75</li>
76</ul>
77<ul>
78<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
79<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
80<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
81<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
82<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
83</ul>
84</li>
85</ul>
86<ul>
87<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
88<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
89<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
90</ul>
91</li>
92</ul>
93<ul>
94<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
95<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
96<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
97<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
98<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
99<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
100<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
101<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
102<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
103<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
104<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
105<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
106<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
107<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
108<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
109<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
110<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
111<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
112<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
113<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
114<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
115<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
116<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
117<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
118<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
119<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
120<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
121</ul>
122</li>
123</ul>
124<ul class="current">
125<li class="toctree-l1 current"><a class="reference internal" href="index.html">Libraries</a><ul class="current">
126<li class="toctree-l2"><a class="reference internal" href="benchmark.html">Benchmarking Class</a></li>
127<li class="toctree-l2"><a class="reference internal" href="caching.html">Caching Driver</a></li>
128<li class="toctree-l2"><a class="reference internal" href="calendar.html">Calendaring Class</a></li>
129<li class="toctree-l2"><a class="reference internal" href="cart.html">Shopping Cart Class</a></li>
130<li class="toctree-l2"><a class="reference internal" href="config.html">Config Class</a></li>
131<li class="toctree-l2"><a class="reference internal" href="email.html">Email Class</a></li>
132<li class="toctree-l2"><a class="reference internal" href="encrypt.html">Encrypt Class</a></li>
133<li class="toctree-l2"><a class="reference internal" href="encryption.html">Encryption Library</a></li>
134<li class="toctree-l2"><a class="reference internal" href="file_uploading.html">File Uploading Class</a></li>
135<li class="toctree-l2"><a class="reference internal" href="form_validation.html">Form Validation</a></li>
136<li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP Class</a></li>
137<li class="toctree-l2"><a class="reference internal" href="image_lib.html">Image Manipulation Class</a></li>
138<li class="toctree-l2"><a class="reference internal" href="input.html">Input Class</a></li>
139<li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript Class</a></li>
140<li class="toctree-l2"><a class="reference internal" href="language.html">Language Class</a></li>
141<li class="toctree-l2"><a class="reference internal" href="loader.html">Loader Class</a></li>
142<li class="toctree-l2"><a class="reference internal" href="migration.html">Migrations Class</a></li>
143<li class="toctree-l2"><a class="reference internal" href="output.html">Output Class</a></li>
144<li class="toctree-l2"><a class="reference internal" href="pagination.html">Pagination Class</a></li>
145<li class="toctree-l2"><a class="reference internal" href="parser.html">Template Parser Class</a></li>
146<li class="toctree-l2"><a class="reference internal" href="security.html">Security Class</a></li>
147<li class="toctree-l2"><a class="reference internal" href="sessions.html">Session Library</a></li>
148<li class="toctree-l2"><a class="reference internal" href="table.html">HTML Table Class</a></li>
149<li class="toctree-l2"><a class="reference internal" href="trackback.html">Trackback Class</a></li>
150<li class="toctree-l2"><a class="reference internal" href="typography.html">Typography Class</a></li>
151<li class="toctree-l2"><a class="reference internal" href="unit_testing.html">Unit Testing Class</a></li>
152<li class="toctree-l2"><a class="reference internal" href="uri.html">URI Class</a></li>
153<li class="toctree-l2"><a class="reference internal" href="user_agent.html">User Agent Class</a></li>
154<li class="toctree-l2 current"><a class="current reference internal" href="#">XML-RPC and XML-RPC Server Classes</a></li>
155<li class="toctree-l2"><a class="reference internal" href="zip.html">Zip Encoding Class</a></li>
156</ul>
157</li>
158</ul>
159<ul>
160<li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
161<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
162<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
163<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
164<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
165<li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
166<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
167<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
168<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
169<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
170<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
171<li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
172<li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
173<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
174<li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
175</ul>
176</li>
177</ul>
178<ul>
179<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
180<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
181<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
182<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
183<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
184<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
185<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
186<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
187<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
188<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
189<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
190<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
191<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
192<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
193<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
194<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
195<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
196<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
197<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
198<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
199<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
200<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
201</ul>
202</li>
203</ul>
204
205 </div>
206
207
208 </div>
209</div>
210<div id="nav2">
211 <a href="#" id="openToc">
212 <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAAAf/bAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBwYGCAoICQkJCQgKCgwMDAwMCgwMDQ0MDBERERERFBQUFBQUFBQUFAEEBQUIBwgPCgoPFA4ODhQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQU/8AAEQgAKwCaAwERAAIRAQMRAf/EAHsAAQAABwEBAAAAAAAAAAAAAAABAwQFBgcIAgkBAQAAAAAAAAAAAAAAAAAAAAAQAAEDAwICBwYEAgsAAAAAAAIBAwQAEQUSBiEHkROTVNQWGDFBUVIUCHEiMtOUFWGBobHRQlMkZIRVEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwDSC+ygkOOaUoKigUCgUCgUCgUCgUCgUCgUCgkuGguIP9FBMFb0Hqg7We+3jlmIqqYFf4ub+/QYlnOR/LqIBKGFUbf8qWv971BytQXXE7Y3Lnm3HsFhp2TaZJAdchRXpIgSpdEJWxJEW3xoKV7F5OMy7JkQn2o7D6w33XGjEAkoiqrJEqIiOIiKuhePCgqp22dyYyS3CyWHnQ5joG61HkRnmnTbaFSMhExRVQRRVJU9iUHjE7ez+fJ0MFipmUNhBV8YUd2SoIV9KkjQla9ltegttBdPLW4/qocL+UTfrMiHW4+P9M71shuyrqaHTcxsl7jegpsji8nh5ZwMvDfgTm0RTjSmjYdFCS6KoOIipdFunCgmNYTMv457MMY6U7iI6oMieDDhRm1VbIhuoOkbqtuK0Hpzb+eZcYZexUxt6UyUqK2cd0SdjtgrhOgijcgERUlJOCIl6CpgbP3blRI8XgMjNARAyKNDfeRBdFDBVUAXgQrqH4pxoJTu2NysY97LP4ac1io5q1InHFeGO24LnVKJuKOkSQ/yKir+rh7aCLG1dzypZQI2FnvTgccYOM3FeN0XWERXAUEFVQgQkUktdLpegm+Td3/Xli/L+S/mYNJIOF9G/wBeLKrZHFb0akG6W1WtQWSg3Dyg5e7V3fipE3O4/wCrktyzYA+ufas2LbZIlmnAT2kvuoN1wft95augilglX/tzP3qCu9O3LL/wV/i5v79BvmTADq14UGu91467Z6U9y0HzH/ncj/U/sT/CgynZG7I2NezpZGUjIycJkYkZSG+uQ81pbBNKLxJfjwoMqZ3/ALYHl35AJ7/cuwHcu5k7r1Q5pHetBjquqVVJWGxj9Zrtcl/Ggy3dHMvauR3HFZj5nHNxSyW5JISYDMoIwx8tFIGHZhPNaykGapr6rUAiicEoMG21lMRj8buPAz8xhJrr7uOeiPTCyAwXUaGR1mgozbTusOsFLEiJ7fbQa/h7gcjy2H3V6xppwDNtUSxCJIqp7valBuWVzJ22xuCROXNNZiJkMtms0DbjUkAZjzoDrTMd9dDRI44ZC2YsrYdKWP2WDT2S3N9dNdlRYrGMYc06IURXSYb0igrpWS485xVNS6nF4rwslkoMwnbpgZLB7bmt5uMweAhDEl4B5uSLzzqTnnyVpW2jaJHRMSIjdDiiotvy3DOE5rYTEbkl5yFn28k7JyG4c7AU2HtLH1uKfaiMPI40CdYbpNtmLdwTSn5rewLNld+7TLdeal4WarWBkbVKBjgdElMJJwAAY5fl4kB3b1fp4XvagsGS3FjJfLzDNtS8aeXx7LzT7TyzByQE5PccRGRC0ZRUDRV6y62vbjagzLmJzS2vuPK43JY6aP1TW6Jz+RIWyFtyC06y3EkiiinAo7YCqfq1AqqnGgsOH3lhZO8d1pmcpB8j5XIm9OYlBJSQ/FSS4427DKO0RC8AlcEMhFdViRR1WDWR5t3WXVuL1d106kG9vdeye2g60+1FDyW0shIcXVpyroXt8I8dfd+NB1vioAdWnD3UF1+gD4UFc6CEKpagxXN43rwJLUHz7yX2c8zokt9uHlsPIhA4aRnnHJTLptIS6CNsY7iASpxUUMkReGpfbQW0vtN5pitvrsN28rwtBD0nc0+/Yft5XhaB6TuaXfsP28rwtA9J3NPv2H7eV4Wgek7mn37D9vK8LQPSdzT79h+3leFoHpO5pd+w/byvC0D0nc0u/Yft5XhaB6TuaXfsP28rwtA9J3NLv2H7eV4Wgek7ml37D9vK8LQPSdzS79h+3leFoHpO5p9+w/byvC0E9r7Reazy2HIYVPxkS/CUHVn26cosxyv2g7h89LYmZSXOenvLEQ1YaQ222RATcQCP8rSGqqA8S02W2pQ6FhMoAIlqCtsnwoCpdKClejI4i3Sgtb+GBxVuNBSFt1pV/RQefLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8uM/JQPLjPyUDy4z8lA8utJ/koJ7WCbBU/LQXOPAFq1koK8B0pag90CggtBBf6qB0UDooHRQOigdFA6KB0UDooHRQOigdFA6KB0UDooI0EaBQf//Z" title="Toggle Table of Contents" alt="Toggle Table of Contents" />
213 </a>
214</div>
215
216 <div class="wy-grid-for-nav">
217
218
219 <nav data-toggle="wy-nav-shift" class="wy-nav-side">
220 <div class="wy-side-nav-search">
221
222 <a href="../index.html" class="fa fa-home"> CodeIgniter</a>
223
224
225<div role="search">
226 <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
227 <input type="text" name="q" placeholder="Search docs" />
228 <input type="hidden" name="check_keywords" value="yes" />
229 <input type="hidden" name="area" value="default" />
230 </form>
231</div>
232 </div>
233
234 <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
235
236
237
238 <ul>
239<li class="toctree-l1"><a class="reference internal" href="../general/welcome.html">Welcome to CodeIgniter</a></li>
240</ul>
241<ul>
242<li class="toctree-l1"><a class="reference internal" href="../installation/index.html">Installation Instructions</a><ul>
243<li class="toctree-l2"><a class="reference internal" href="../installation/downloads.html">Downloading CodeIgniter</a></li>
244<li class="toctree-l2"><a class="reference internal" href="../installation/index.html">Installation Instructions</a></li>
245<li class="toctree-l2"><a class="reference internal" href="../installation/upgrading.html">Upgrading From a Previous Version</a></li>
246<li class="toctree-l2"><a class="reference internal" href="../installation/troubleshooting.html">Troubleshooting</a></li>
247</ul>
248</li>
249</ul>
250<ul>
251<li class="toctree-l1"><a class="reference internal" href="../overview/index.html">CodeIgniter Overview</a><ul>
252<li class="toctree-l2"><a class="reference internal" href="../overview/getting_started.html">Getting Started</a></li>
253<li class="toctree-l2"><a class="reference internal" href="../overview/at_a_glance.html">CodeIgniter at a Glance</a></li>
254<li class="toctree-l2"><a class="reference internal" href="../overview/features.html">Supported Features</a></li>
255<li class="toctree-l2"><a class="reference internal" href="../overview/appflow.html">Application Flow Chart</a></li>
256<li class="toctree-l2"><a class="reference internal" href="../overview/mvc.html">Model-View-Controller</a></li>
257<li class="toctree-l2"><a class="reference internal" href="../overview/goals.html">Architectural Goals</a></li>
258</ul>
259</li>
260</ul>
261<ul>
262<li class="toctree-l1"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><ul>
263<li class="toctree-l2"><a class="reference internal" href="../tutorial/static_pages.html">Static pages</a></li>
264<li class="toctree-l2"><a class="reference internal" href="../tutorial/news_section.html">News section</a></li>
265<li class="toctree-l2"><a class="reference internal" href="../tutorial/create_news_items.html">Create news items</a></li>
266<li class="toctree-l2"><a class="reference internal" href="../tutorial/conclusion.html">Conclusion</a></li>
267</ul>
268</li>
269</ul>
270<ul>
271<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing to CodeIgniter</a><ul>
272<li class="toctree-l2"><a class="reference internal" href="../documentation/index.html">Writing CodeIgniter Documentation</a></li>
273<li class="toctree-l2"><a class="reference internal" href="../DCO.html">Developer’s Certificate of Origin 1.1</a></li>
274</ul>
275</li>
276</ul>
277<ul>
278<li class="toctree-l1"><a class="reference internal" href="../general/index.html">General Topics</a><ul>
279<li class="toctree-l2"><a class="reference internal" href="../general/urls.html">CodeIgniter URLs</a></li>
280<li class="toctree-l2"><a class="reference internal" href="../general/controllers.html">Controllers</a></li>
281<li class="toctree-l2"><a class="reference internal" href="../general/reserved_names.html">Reserved Names</a></li>
282<li class="toctree-l2"><a class="reference internal" href="../general/views.html">Views</a></li>
283<li class="toctree-l2"><a class="reference internal" href="../general/models.html">Models</a></li>
284<li class="toctree-l2"><a class="reference internal" href="../general/helpers.html">Helpers</a></li>
285<li class="toctree-l2"><a class="reference internal" href="../general/libraries.html">Using CodeIgniter Libraries</a></li>
286<li class="toctree-l2"><a class="reference internal" href="../general/creating_libraries.html">Creating Libraries</a></li>
287<li class="toctree-l2"><a class="reference internal" href="../general/drivers.html">Using CodeIgniter Drivers</a></li>
288<li class="toctree-l2"><a class="reference internal" href="../general/creating_drivers.html">Creating Drivers</a></li>
289<li class="toctree-l2"><a class="reference internal" href="../general/core_classes.html">Creating Core System Classes</a></li>
290<li class="toctree-l2"><a class="reference internal" href="../general/ancillary_classes.html">Creating Ancillary Classes</a></li>
291<li class="toctree-l2"><a class="reference internal" href="../general/hooks.html">Hooks - Extending the Framework Core</a></li>
292<li class="toctree-l2"><a class="reference internal" href="../general/autoloader.html">Auto-loading Resources</a></li>
293<li class="toctree-l2"><a class="reference internal" href="../general/common_functions.html">Common Functions</a></li>
294<li class="toctree-l2"><a class="reference internal" href="../general/compatibility_functions.html">Compatibility Functions</a></li>
295<li class="toctree-l2"><a class="reference internal" href="../general/routing.html">URI Routing</a></li>
296<li class="toctree-l2"><a class="reference internal" href="../general/errors.html">Error Handling</a></li>
297<li class="toctree-l2"><a class="reference internal" href="../general/caching.html">Caching</a></li>
298<li class="toctree-l2"><a class="reference internal" href="../general/profiling.html">Profiling Your Application</a></li>
299<li class="toctree-l2"><a class="reference internal" href="../general/cli.html">Running via the CLI</a></li>
300<li class="toctree-l2"><a class="reference internal" href="../general/managing_apps.html">Managing your Applications</a></li>
301<li class="toctree-l2"><a class="reference internal" href="../general/environments.html">Handling Multiple Environments</a></li>
302<li class="toctree-l2"><a class="reference internal" href="../general/alternative_php.html">Alternate PHP Syntax for View Files</a></li>
303<li class="toctree-l2"><a class="reference internal" href="../general/security.html">Security</a></li>
304<li class="toctree-l2"><a class="reference internal" href="../general/styleguide.html">PHP Style Guide</a></li>
305</ul>
306</li>
307</ul>
308<ul class="current">
309<li class="toctree-l1 current"><a class="reference internal" href="index.html">Libraries</a><ul class="current">
310<li class="toctree-l2"><a class="reference internal" href="benchmark.html">Benchmarking Class</a></li>
311<li class="toctree-l2"><a class="reference internal" href="caching.html">Caching Driver</a></li>
312<li class="toctree-l2"><a class="reference internal" href="calendar.html">Calendaring Class</a></li>
313<li class="toctree-l2"><a class="reference internal" href="cart.html">Shopping Cart Class</a></li>
314<li class="toctree-l2"><a class="reference internal" href="config.html">Config Class</a></li>
315<li class="toctree-l2"><a class="reference internal" href="email.html">Email Class</a></li>
316<li class="toctree-l2"><a class="reference internal" href="encrypt.html">Encrypt Class</a></li>
317<li class="toctree-l2"><a class="reference internal" href="encryption.html">Encryption Library</a></li>
318<li class="toctree-l2"><a class="reference internal" href="file_uploading.html">File Uploading Class</a></li>
319<li class="toctree-l2"><a class="reference internal" href="form_validation.html">Form Validation</a></li>
320<li class="toctree-l2"><a class="reference internal" href="ftp.html">FTP Class</a></li>
321<li class="toctree-l2"><a class="reference internal" href="image_lib.html">Image Manipulation Class</a></li>
322<li class="toctree-l2"><a class="reference internal" href="input.html">Input Class</a></li>
323<li class="toctree-l2"><a class="reference internal" href="javascript.html">Javascript Class</a></li>
324<li class="toctree-l2"><a class="reference internal" href="language.html">Language Class</a></li>
325<li class="toctree-l2"><a class="reference internal" href="loader.html">Loader Class</a></li>
326<li class="toctree-l2"><a class="reference internal" href="migration.html">Migrations Class</a></li>
327<li class="toctree-l2"><a class="reference internal" href="output.html">Output Class</a></li>
328<li class="toctree-l2"><a class="reference internal" href="pagination.html">Pagination Class</a></li>
329<li class="toctree-l2"><a class="reference internal" href="parser.html">Template Parser Class</a></li>
330<li class="toctree-l2"><a class="reference internal" href="security.html">Security Class</a></li>
331<li class="toctree-l2"><a class="reference internal" href="sessions.html">Session Library</a></li>
332<li class="toctree-l2"><a class="reference internal" href="table.html">HTML Table Class</a></li>
333<li class="toctree-l2"><a class="reference internal" href="trackback.html">Trackback Class</a></li>
334<li class="toctree-l2"><a class="reference internal" href="typography.html">Typography Class</a></li>
335<li class="toctree-l2"><a class="reference internal" href="unit_testing.html">Unit Testing Class</a></li>
336<li class="toctree-l2"><a class="reference internal" href="uri.html">URI Class</a></li>
337<li class="toctree-l2"><a class="reference internal" href="user_agent.html">User Agent Class</a></li>
338<li class="toctree-l2 current"><a class="current reference internal" href="#">XML-RPC and XML-RPC Server Classes</a></li>
339<li class="toctree-l2"><a class="reference internal" href="zip.html">Zip Encoding Class</a></li>
340</ul>
341</li>
342</ul>
343<ul>
344<li class="toctree-l1"><a class="reference internal" href="../database/index.html">Database Reference</a><ul>
345<li class="toctree-l2"><a class="reference internal" href="../database/examples.html">Quick Start: Usage Examples</a></li>
346<li class="toctree-l2"><a class="reference internal" href="../database/configuration.html">Database Configuration</a></li>
347<li class="toctree-l2"><a class="reference internal" href="../database/connecting.html">Connecting to a Database</a></li>
348<li class="toctree-l2"><a class="reference internal" href="../database/queries.html">Running Queries</a></li>
349<li class="toctree-l2"><a class="reference internal" href="../database/results.html">Generating Query Results</a></li>
350<li class="toctree-l2"><a class="reference internal" href="../database/helpers.html">Query Helper Functions</a></li>
351<li class="toctree-l2"><a class="reference internal" href="../database/query_builder.html">Query Builder Class</a></li>
352<li class="toctree-l2"><a class="reference internal" href="../database/transactions.html">Transactions</a></li>
353<li class="toctree-l2"><a class="reference internal" href="../database/metadata.html">Getting MetaData</a></li>
354<li class="toctree-l2"><a class="reference internal" href="../database/call_function.html">Custom Function Calls</a></li>
355<li class="toctree-l2"><a class="reference internal" href="../database/caching.html">Query Caching</a></li>
356<li class="toctree-l2"><a class="reference internal" href="../database/forge.html">Database Manipulation with Database Forge</a></li>
357<li class="toctree-l2"><a class="reference internal" href="../database/utilities.html">Database Utilities Class</a></li>
358<li class="toctree-l2"><a class="reference internal" href="../database/db_driver_reference.html">Database Driver Reference</a></li>
359</ul>
360</li>
361</ul>
362<ul>
363<li class="toctree-l1"><a class="reference internal" href="../helpers/index.html">Helpers</a><ul>
364<li class="toctree-l2"><a class="reference internal" href="../helpers/array_helper.html">Array Helper</a></li>
365<li class="toctree-l2"><a class="reference internal" href="../helpers/captcha_helper.html">CAPTCHA Helper</a></li>
366<li class="toctree-l2"><a class="reference internal" href="../helpers/cookie_helper.html">Cookie Helper</a></li>
367<li class="toctree-l2"><a class="reference internal" href="../helpers/date_helper.html">Date Helper</a></li>
368<li class="toctree-l2"><a class="reference internal" href="../helpers/directory_helper.html">Directory Helper</a></li>
369<li class="toctree-l2"><a class="reference internal" href="../helpers/download_helper.html">Download Helper</a></li>
370<li class="toctree-l2"><a class="reference internal" href="../helpers/email_helper.html">Email Helper</a></li>
371<li class="toctree-l2"><a class="reference internal" href="../helpers/file_helper.html">File Helper</a></li>
372<li class="toctree-l2"><a class="reference internal" href="../helpers/form_helper.html">Form Helper</a></li>
373<li class="toctree-l2"><a class="reference internal" href="../helpers/html_helper.html">HTML Helper</a></li>
374<li class="toctree-l2"><a class="reference internal" href="../helpers/inflector_helper.html">Inflector Helper</a></li>
375<li class="toctree-l2"><a class="reference internal" href="../helpers/language_helper.html">Language Helper</a></li>
376<li class="toctree-l2"><a class="reference internal" href="../helpers/number_helper.html">Number Helper</a></li>
377<li class="toctree-l2"><a class="reference internal" href="../helpers/path_helper.html">Path Helper</a></li>
378<li class="toctree-l2"><a class="reference internal" href="../helpers/security_helper.html">Security Helper</a></li>
379<li class="toctree-l2"><a class="reference internal" href="../helpers/smiley_helper.html">Smiley Helper</a></li>
380<li class="toctree-l2"><a class="reference internal" href="../helpers/string_helper.html">String Helper</a></li>
381<li class="toctree-l2"><a class="reference internal" href="../helpers/text_helper.html">Text Helper</a></li>
382<li class="toctree-l2"><a class="reference internal" href="../helpers/typography_helper.html">Typography Helper</a></li>
383<li class="toctree-l2"><a class="reference internal" href="../helpers/url_helper.html">URL Helper</a></li>
384<li class="toctree-l2"><a class="reference internal" href="../helpers/xml_helper.html">XML Helper</a></li>
385</ul>
386</li>
387</ul>
388
389
390
391 </div>
392 &nbsp;
393 </nav>
394
395 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
396
397
398 <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
399 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
400 <a href="../index.html">CodeIgniter</a>
401 </nav>
402
403
404
405 <div class="wy-nav-content">
406 <div class="rst-content">
407 <div role="navigation" aria-label="breadcrumbs navigation">
408 <ul class="wy-breadcrumbs">
409 <li><a href="../index.html">Docs</a> &raquo;</li>
410
411 <li><a href="index.html">Libraries</a> &raquo;</li>
412
413 <li>XML-RPC and XML-RPC Server Classes</li>
414 <li class="wy-breadcrumbs-aside">
415
416 </li>
417 <div style="float:right;margin-left:5px;" id="closeMe">
418 <img title="Classic Layout" alt="classic layout" src="data:image/gif;base64,R0lGODlhFAAUAJEAAAAAADMzM////wAAACH5BAUUAAIALAAAAAAUABQAAAImlI+py+0PU5gRBRDM3DxbWoXis42X13USOLauUIqnlsaH/eY6UwAAOw==" />
419 </div>
420 </ul>
421 <hr/>
422</div>
423 <div role="main" class="document">
424
425 <div class="section" id="xml-rpc-and-xml-rpc-server-classes">
426<h1>XML-RPC and XML-RPC Server Classes<a class="headerlink" href="#xml-rpc-and-xml-rpc-server-classes" title="Permalink to this headline"></a></h1>
427<p>CodeIgniter’s XML-RPC classes permit you to send requests to another
428server, or set up your own XML-RPC server to receive requests.</p>
429<div class="contents local topic" id="contents">
430<ul class="simple">
431<li><a class="reference internal" href="#what-is-xml-rpc" id="id3">What is XML-RPC?</a></li>
432<li><a class="reference internal" href="#using-the-xml-rpc-class" id="id4">Using the XML-RPC Class</a><ul>
433<li><a class="reference internal" href="#initializing-the-class" id="id5">Initializing the Class</a></li>
434<li><a class="reference internal" href="#sending-xml-rpc-requests" id="id6">Sending XML-RPC Requests</a><ul>
435<li><a class="reference internal" href="#explanation" id="id7">Explanation</a></li>
436</ul>
437</li>
438<li><a class="reference internal" href="#anatomy-of-a-request" id="id8">Anatomy of a Request</a></li>
439<li><a class="reference internal" href="#creating-an-xml-rpc-server" id="id9">Creating an XML-RPC Server</a></li>
440<li><a class="reference internal" href="#processing-server-requests" id="id10">Processing Server Requests</a><ul>
441<li><a class="reference internal" href="#notes" id="id11">Notes:</a></li>
442</ul>
443</li>
444<li><a class="reference internal" href="#formatting-a-response" id="id12">Formatting a Response</a></li>
445<li><a class="reference internal" href="#sending-an-error-response" id="id13">Sending an Error Response</a></li>
446<li><a class="reference internal" href="#creating-your-own-client-and-server" id="id14">Creating Your Own Client and Server</a><ul>
447<li><a class="reference internal" href="#the-client" id="id15">The Client</a></li>
448<li><a class="reference internal" href="#the-server" id="id16">The Server</a></li>
449<li><a class="reference internal" href="#try-it" id="id17">Try it!</a></li>
450</ul>
451</li>
452<li><a class="reference internal" href="#using-associative-arrays-in-a-request-parameter" id="id18">Using Associative Arrays In a Request Parameter</a></li>
453<li><a class="reference internal" href="#id2" id="id19">Data Types</a></li>
454</ul>
455</li>
456<li><a class="reference internal" href="#class-reference" id="id20">Class Reference</a></li>
457</ul>
458</div>
459<div class="custom-index container"></div><div class="section" id="what-is-xml-rpc">
460<h2><a class="toc-backref" href="#id3">What is XML-RPC?</a><a class="headerlink" href="#what-is-xml-rpc" title="Permalink to this headline"></a></h2>
461<p>Quite simply it is a way for two computers to communicate over the
462internet using XML. One computer, which we will call the client, sends
463an XML-RPC <strong>request</strong> to another computer, which we will call the
464server. Once the server receives and processes the request it will send
465back a <strong>response</strong> to the client.</p>
466<p>For example, using the MetaWeblog API, an XML-RPC Client (usually a
467desktop publishing tool) will send a request to an XML-RPC Server
468running on your site. This request might be a new weblog entry being
469sent for publication, or it could be a request for an existing entry for
470editing. When the XML-RPC Server receives this request it will examine
471it to determine which class/method should be called to process the
472request. Once processed, the server will then send back a response
473message.</p>
474<p>For detailed specifications, you can visit the <a class="reference external" href="http://www.xmlrpc.com/">XML-RPC</a> site.</p>
475</div>
476<div class="section" id="using-the-xml-rpc-class">
477<h2><a class="toc-backref" href="#id4">Using the XML-RPC Class</a><a class="headerlink" href="#using-the-xml-rpc-class" title="Permalink to this headline"></a></h2>
478<div class="section" id="initializing-the-class">
479<h3><a class="toc-backref" href="#id5">Initializing the Class</a><a class="headerlink" href="#initializing-the-class" title="Permalink to this headline"></a></h3>
480<p>Like most other classes in CodeIgniter, the XML-RPC and XML-RPCS classes
481are initialized in your controller using the $this-&gt;load-&gt;library
482function:</p>
483<p>To load the XML-RPC class you will use:</p>
484<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpc&#39;</span><span class="p">);</span>
485</pre></div>
486</div>
487<p>Once loaded, the xml-rpc library object will be available using:
488$this-&gt;xmlrpc</p>
489<p>To load the XML-RPC Server class you will use:</p>
490<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpc&#39;</span><span class="p">);</span>
491<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpcs&#39;</span><span class="p">);</span>
492</pre></div>
493</div>
494<p>Once loaded, the xml-rpcs library object will be available using:
495$this-&gt;xmlrpcs</p>
496<div class="admonition note">
497<p class="first admonition-title">Note</p>
498<p class="last">When using the XML-RPC Server class you must load BOTH the
499XML-RPC class and the XML-RPC Server class.</p>
500</div>
501</div>
502<div class="section" id="sending-xml-rpc-requests">
503<h3><a class="toc-backref" href="#id6">Sending XML-RPC Requests</a><a class="headerlink" href="#sending-xml-rpc-requests" title="Permalink to this headline"></a></h3>
504<p>To send a request to an XML-RPC server you must specify the following
505information:</p>
506<ul class="simple">
507<li>The URL of the server</li>
508<li>The method on the server you wish to call</li>
509<li>The <em>request</em> data (explained below).</li>
510</ul>
511<p>Here is a basic example that sends a simple Weblogs.com ping to the
512<a class="reference external" href="http://pingomatic.com/">Ping-o-Matic</a></p>
513<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpc&#39;</span><span class="p">);</span>
514
515<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">server</span><span class="p">(</span><span class="s1">&#39;http://rpc.pingomatic.com/&#39;</span><span class="p">,</span> <span class="mi">80</span><span class="p">);</span>
516<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">method</span><span class="p">(</span><span class="s1">&#39;weblogUpdates.ping&#39;</span><span class="p">);</span>
517
518<span class="nv">$request</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;My Photoblog&#39;</span><span class="p">,</span> <span class="s1">&#39;http://www.my-site.com/photoblog/&#39;</span><span class="p">);</span>
519<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">request</span><span class="p">(</span><span class="nv">$request</span><span class="p">);</span>
520
521<span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">send_request</span><span class="p">())</span>
522<span class="p">{</span>
523 <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">display_error</span><span class="p">();</span>
524<span class="p">}</span>
525</pre></div>
526</div>
527<div class="section" id="explanation">
528<h4><a class="toc-backref" href="#id7">Explanation</a><a class="headerlink" href="#explanation" title="Permalink to this headline"></a></h4>
529<p>The above code initializes the XML-RPC class, sets the server URL and
530method to be called (weblogUpdates.ping). The request (in this case, the
531title and URL of your site) is placed into an array for transportation,
532and compiled using the request() function. Lastly, the full request is
533sent. If the send_request() method returns false we will display the
534error message sent back from the XML-RPC Server.</p>
535</div>
536</div>
537<div class="section" id="anatomy-of-a-request">
538<h3><a class="toc-backref" href="#id8">Anatomy of a Request</a><a class="headerlink" href="#anatomy-of-a-request" title="Permalink to this headline"></a></h3>
539<p>An XML-RPC request is simply the data you are sending to the XML-RPC
540server. Each piece of data in a request is referred to as a request
541parameter. The above example has two parameters: The URL and title of
542your site. When the XML-RPC server receives your request, it will look
543for parameters it requires.</p>
544<p>Request parameters must be placed into an array for transportation, and
545each parameter can be one of seven data types (strings, numbers, dates,
546etc.). If your parameters are something other than strings you will have
547to include the data type in the request array.</p>
548<p>Here is an example of a simple array with three parameters:</p>
549<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$request</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;John&#39;</span><span class="p">,</span> <span class="s1">&#39;Doe&#39;</span><span class="p">,</span> <span class="s1">&#39;www.some-site.com&#39;</span><span class="p">);</span>
550<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">request</span><span class="p">(</span><span class="nv">$request</span><span class="p">);</span>
551</pre></div>
552</div>
553<p>If you use data types other than strings, or if you have several
554different data types, you will place each parameter into its own array,
555with the data type in the second position:</p>
556<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$request</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
557 <span class="k">array</span><span class="p">(</span><span class="s1">&#39;John&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
558 <span class="k">array</span><span class="p">(</span><span class="s1">&#39;Doe&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
559 <span class="k">array</span><span class="p">(</span><span class="k">FALSE</span><span class="p">,</span> <span class="s1">&#39;boolean&#39;</span><span class="p">),</span>
560 <span class="k">array</span><span class="p">(</span><span class="mi">12345</span><span class="p">,</span> <span class="s1">&#39;int&#39;</span><span class="p">)</span>
561<span class="p">);</span>
562<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">request</span><span class="p">(</span><span class="nv">$request</span><span class="p">);</span>
563</pre></div>
564</div>
565<p>The <a class="reference external" href="#datatypes">Data Types</a> section below has a full list of data
566types.</p>
567</div>
568<div class="section" id="creating-an-xml-rpc-server">
569<h3><a class="toc-backref" href="#id9">Creating an XML-RPC Server</a><a class="headerlink" href="#creating-an-xml-rpc-server" title="Permalink to this headline"></a></h3>
570<p>An XML-RPC Server acts as a traffic cop of sorts, waiting for incoming
571requests and redirecting them to the appropriate functions for
572processing.</p>
573<p>To create your own XML-RPC server involves initializing the XML-RPC
574Server class in your controller where you expect the incoming request to
575appear, then setting up an array with mapping instructions so that
576incoming requests can be sent to the appropriate class and method for
577processing.</p>
578<p>Here is an example to illustrate:</p>
579<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpc&#39;</span><span class="p">);</span>
580<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpcs&#39;</span><span class="p">);</span>
581
582<span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;functions&#39;</span><span class="p">][</span><span class="s1">&#39;new_post&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;function&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;My_blog.new_entry&#39;</span><span class="p">);</span>
583<span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;functions&#39;</span><span class="p">][</span><span class="s1">&#39;update_post&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;function&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;My_blog.update_entry&#39;</span><span class="p">);</span>
584<span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;object&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$this</span><span class="p">;</span>
585
586<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpcs</span><span class="o">-&gt;</span><span class="na">initialize</span><span class="p">(</span><span class="nv">$config</span><span class="p">);</span>
587<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpcs</span><span class="o">-&gt;</span><span class="na">serve</span><span class="p">();</span>
588</pre></div>
589</div>
590<p>The above example contains an array specifying two method requests that
591the Server allows. The allowed methods are on the left side of the
592array. When either of those are received, they will be mapped to the
593class and method on the right.</p>
594<p>The ‘object’ key is a special key that you pass an instantiated class
595object with, which is necessary when the method you are mapping to is
596not part of the CodeIgniter super object.</p>
597<p>In other words, if an XML-RPC Client sends a request for the new_post
598method, your server will load the My_blog class and call the new_entry
599function. If the request is for the update_post method, your server
600will load the My_blog class and call the <code class="docutils literal"><span class="pre">update_entry()</span></code> method.</p>
601<p>The function names in the above example are arbitrary. You’ll decide
602what they should be called on your server, or if you are using
603standardized APIs, like the Blogger or MetaWeblog API, you’ll use their
604function names.</p>
605<p>There are two additional configuration keys you may make use of when
606initializing the server class: debug can be set to TRUE in order to
607enable debugging, and xss_clean may be set to FALSE to prevent sending
608data through the Security library’s <code class="docutils literal"><span class="pre">xss_clean()</span></code> method.</p>
609</div>
610<div class="section" id="processing-server-requests">
611<h3><a class="toc-backref" href="#id10">Processing Server Requests</a><a class="headerlink" href="#processing-server-requests" title="Permalink to this headline"></a></h3>
612<p>When the XML-RPC Server receives a request and loads the class/method
613for processing, it will pass an object to that method containing the
614data sent by the client.</p>
615<p>Using the above example, if the new_post method is requested, the
616server will expect a class to exist with this prototype:</p>
617<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">My_blog</span> <span class="k">extends</span> <span class="nx">CI_Controller</span> <span class="p">{</span>
618
619 <span class="k">public</span> <span class="k">function</span> <span class="nf">new_post</span><span class="p">(</span><span class="nv">$request</span><span class="p">)</span>
620 <span class="p">{</span>
621
622 <span class="p">}</span>
623<span class="p">}</span>
624</pre></div>
625</div>
626<p>The $request variable is an object compiled by the Server, which
627contains the data sent by the XML-RPC Client. Using this object you will
628have access to the <em>request parameters</em> enabling you to process the
629request. When you are done you will send a Response back to the Client.</p>
630<p>Below is a real-world example, using the Blogger API. One of the methods
631in the Blogger API is <code class="docutils literal"><span class="pre">getUserInfo()</span></code>. Using this method, an XML-RPC
632Client can send the Server a username and password, in return the Server
633sends back information about that particular user (nickname, user ID,
634email address, etc.). Here is how the processing function might look:</p>
635<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">My_blog</span> <span class="k">extends</span> <span class="nx">CI_Controller</span> <span class="p">{</span>
636
637 <span class="k">public</span> <span class="k">function</span> <span class="nf">getUserInfo</span><span class="p">(</span><span class="nv">$request</span><span class="p">)</span>
638 <span class="p">{</span>
639 <span class="nv">$username</span> <span class="o">=</span> <span class="s1">&#39;smitty&#39;</span><span class="p">;</span>
640 <span class="nv">$password</span> <span class="o">=</span> <span class="s1">&#39;secretsmittypass&#39;</span><span class="p">;</span>
641
642 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpc&#39;</span><span class="p">);</span>
643
644 <span class="nv">$parameters</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">output_parameters</span><span class="p">();</span>
645
646 <span class="k">if</span> <span class="p">(</span><span class="nv">$parameters</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="nv">$username</span> <span class="o">&amp;&amp;</span> <span class="nv">$parameters</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">!=</span> <span class="nv">$password</span><span class="p">)</span>
647 <span class="p">{</span>
648 <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">send_error_message</span><span class="p">(</span><span class="s1">&#39;100&#39;</span><span class="p">,</span> <span class="s1">&#39;Invalid Access&#39;</span><span class="p">);</span>
649 <span class="p">}</span>
650
651 <span class="nv">$response</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
652 <span class="k">array</span><span class="p">(</span>
653 <span class="s1">&#39;nickname&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;Smitty&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
654 <span class="s1">&#39;userid&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;99&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
655 <span class="s1">&#39;url&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;http://yoursite.com&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
656 <span class="s1">&#39;email&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;jsmith@yoursite.com&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
657 <span class="s1">&#39;lastname&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;Smith&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
658 <span class="s1">&#39;firstname&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;John&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">)</span>
659 <span class="p">),</span>
660 <span class="s1">&#39;struct&#39;</span>
661 <span class="p">);</span>
662
663 <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">send_response</span><span class="p">(</span><span class="nv">$response</span><span class="p">);</span>
664 <span class="p">}</span>
665<span class="p">}</span>
666</pre></div>
667</div>
668<div class="section" id="notes">
669<h4><a class="toc-backref" href="#id11">Notes:</a><a class="headerlink" href="#notes" title="Permalink to this headline"></a></h4>
670<p>The <code class="docutils literal"><span class="pre">output_parameters()</span></code> method retrieves an indexed array
671corresponding to the request parameters sent by the client. In the above
672example, the output parameters will be the username and password.</p>
673<p>If the username and password sent by the client were not valid, and
674error message is returned using <code class="docutils literal"><span class="pre">send_error_message()</span></code>.</p>
675<p>If the operation was successful, the client will be sent back a response
676array containing the user’s info.</p>
677</div>
678</div>
679<div class="section" id="formatting-a-response">
680<h3><a class="toc-backref" href="#id12">Formatting a Response</a><a class="headerlink" href="#formatting-a-response" title="Permalink to this headline"></a></h3>
681<p>Similar to <em>Requests</em>, <em>Responses</em> must be formatted as an array.
682However, unlike requests, a response is an array <strong>that contains a
683single item</strong>. This item can be an array with several additional arrays,
684but there can be only one primary array index. In other words, the basic
685prototype is this:</p>
686<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$response</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;Response data&#39;</span><span class="p">,</span> <span class="s1">&#39;array&#39;</span><span class="p">);</span>
687</pre></div>
688</div>
689<p>Responses, however, usually contain multiple pieces of information. In
690order to accomplish this we must put the response into its own array so
691that the primary array continues to contain a single piece of data.
692Here’s an example showing how this might be accomplished:</p>
693<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$response</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
694 <span class="k">array</span><span class="p">(</span>
695 <span class="s1">&#39;first_name&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;John&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
696 <span class="s1">&#39;last_name&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;Doe&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span>
697 <span class="s1">&#39;member_id&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="mi">123435</span><span class="p">,</span> <span class="s1">&#39;int&#39;</span><span class="p">),</span>
698 <span class="s1">&#39;todo_list&#39;</span> <span class="o">=&gt;</span> <span class="k">array</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">&#39;clean house&#39;</span><span class="p">,</span> <span class="s1">&#39;call mom&#39;</span><span class="p">,</span> <span class="s1">&#39;water plants&#39;</span><span class="p">),</span> <span class="s1">&#39;array&#39;</span><span class="p">),</span>
699 <span class="p">),</span>
700 <span class="s1">&#39;struct&#39;</span>
701<span class="p">);</span>
702</pre></div>
703</div>
704<p>Notice that the above array is formatted as a struct. This is the most
705common data type for responses.</p>
706<p>As with Requests, a response can be one of the seven data types listed
707in the <a class="reference external" href="#datatypes">Data Types</a> section.</p>
708</div>
709<div class="section" id="sending-an-error-response">
710<h3><a class="toc-backref" href="#id13">Sending an Error Response</a><a class="headerlink" href="#sending-an-error-response" title="Permalink to this headline"></a></h3>
711<p>If you need to send the client an error response you will use the
712following:</p>
713<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">send_error_message</span><span class="p">(</span><span class="s1">&#39;123&#39;</span><span class="p">,</span> <span class="s1">&#39;Requested data not available&#39;</span><span class="p">);</span>
714</pre></div>
715</div>
716<p>The first parameter is the error number while the second parameter is
717the error message.</p>
718</div>
719<div class="section" id="creating-your-own-client-and-server">
720<h3><a class="toc-backref" href="#id14">Creating Your Own Client and Server</a><a class="headerlink" href="#creating-your-own-client-and-server" title="Permalink to this headline"></a></h3>
721<p>To help you understand everything we’ve covered thus far, let’s create a
722couple controllers that act as XML-RPC Client and Server. You’ll use the
723Client to send a request to the Server and receive a response.</p>
724<div class="section" id="the-client">
725<h4><a class="toc-backref" href="#id15">The Client</a><a class="headerlink" href="#the-client" title="Permalink to this headline"></a></h4>
726<p>Using a text editor, create a controller called Xmlrpc_client.php. In
727it, place this code and save it to your application/controllers/
728folder:</p>
729<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
730
731<span class="k">class</span> <span class="nc">Xmlrpc_client</span> <span class="k">extends</span> <span class="nx">CI_Controller</span> <span class="p">{</span>
732
733 <span class="k">public</span> <span class="k">function</span> <span class="nf">index</span><span class="p">()</span>
734 <span class="p">{</span>
735 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">helper</span><span class="p">(</span><span class="s1">&#39;url&#39;</span><span class="p">);</span>
736 <span class="nv">$server_url</span> <span class="o">=</span> <span class="nx">site_url</span><span class="p">(</span><span class="s1">&#39;xmlrpc_server&#39;</span><span class="p">);</span>
737
738 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpc&#39;</span><span class="p">);</span>
739
740 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">server</span><span class="p">(</span><span class="nv">$server_url</span><span class="p">,</span> <span class="mi">80</span><span class="p">);</span>
741 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">method</span><span class="p">(</span><span class="s1">&#39;Greetings&#39;</span><span class="p">);</span>
742
743 <span class="nv">$request</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;How is it going?&#39;</span><span class="p">);</span>
744 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">request</span><span class="p">(</span><span class="nv">$request</span><span class="p">);</span>
745
746 <span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">send_request</span><span class="p">())</span>
747 <span class="p">{</span>
748 <span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">display_error</span><span class="p">();</span>
749 <span class="p">}</span>
750 <span class="k">else</span>
751 <span class="p">{</span>
752 <span class="k">echo</span> <span class="s1">&#39;&lt;pre&gt;&#39;</span><span class="p">;</span>
753 <span class="nb">print_r</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">display_response</span><span class="p">());</span>
754 <span class="k">echo</span> <span class="s1">&#39;&lt;/pre&gt;&#39;</span><span class="p">;</span>
755 <span class="p">}</span>
756 <span class="p">}</span>
757<span class="p">}</span>
758<span class="cp">?&gt;</span>
759</pre></div>
760</div>
761<div class="admonition note">
762<p class="first admonition-title">Note</p>
763<p class="last">In the above code we are using a “url helper”. You can find more
764information in the <a class="reference internal" href="../general/helpers.html"><span class="doc">Helpers Functions</span></a> page.</p>
765</div>
766</div>
767<div class="section" id="the-server">
768<h4><a class="toc-backref" href="#id16">The Server</a><a class="headerlink" href="#the-server" title="Permalink to this headline"></a></h4>
769<p>Using a text editor, create a controller called Xmlrpc_server.php. In
770it, place this code and save it to your application/controllers/
771folder:</p>
772<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
773
774<span class="k">class</span> <span class="nc">Xmlrpc_server</span> <span class="k">extends</span> <span class="nx">CI_Controller</span> <span class="p">{</span>
775
776 <span class="k">public</span> <span class="k">function</span> <span class="nf">index</span><span class="p">()</span>
777 <span class="p">{</span>
778 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpc&#39;</span><span class="p">);</span>
779 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">load</span><span class="o">-&gt;</span><span class="na">library</span><span class="p">(</span><span class="s1">&#39;xmlrpcs&#39;</span><span class="p">);</span>
780
781 <span class="nv">$config</span><span class="p">[</span><span class="s1">&#39;functions&#39;</span><span class="p">][</span><span class="s1">&#39;Greetings&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;function&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Xmlrpc_server.process&#39;</span><span class="p">);</span>
782
783 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpcs</span><span class="o">-&gt;</span><span class="na">initialize</span><span class="p">(</span><span class="nv">$config</span><span class="p">);</span>
784 <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpcs</span><span class="o">-&gt;</span><span class="na">serve</span><span class="p">();</span>
785 <span class="p">}</span>
786
787
788 <span class="k">public</span> <span class="k">function</span> <span class="nf">process</span><span class="p">(</span><span class="nv">$request</span><span class="p">)</span>
789 <span class="p">{</span>
790 <span class="nv">$parameters</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">output_parameters</span><span class="p">();</span>
791
792 <span class="nv">$response</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
793 <span class="k">array</span><span class="p">(</span>
794 <span class="s1">&#39;you_said&#39;</span> <span class="o">=&gt;</span> <span class="nv">$parameters</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
795 <span class="s1">&#39;i_respond&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;Not bad at all.&#39;</span>
796 <span class="p">),</span>
797 <span class="s1">&#39;struct&#39;</span>
798 <span class="p">);</span>
799
800 <span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">send_response</span><span class="p">(</span><span class="nv">$response</span><span class="p">);</span>
801 <span class="p">}</span>
802<span class="p">}</span>
803</pre></div>
804</div>
805</div>
806<div class="section" id="try-it">
807<h4><a class="toc-backref" href="#id17">Try it!</a><a class="headerlink" href="#try-it" title="Permalink to this headline"></a></h4>
808<p>Now visit the your site using a URL similar to this:</p>
809<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nx">example</span><span class="o">.</span><span class="nx">com</span><span class="o">/</span><span class="nx">index</span><span class="o">.</span><span class="nx">php</span><span class="o">/</span><span class="nx">xmlrpc_client</span><span class="o">/</span>
810</pre></div>
811</div>
812<p>You should now see the message you sent to the server, and its response
813back to you.</p>
814<p>The client you created sends a message (“How’s is going?”) to the
815server, along with a request for the “Greetings” method. The Server
816receives the request and maps it to the <code class="docutils literal"><span class="pre">process()</span></code> method, where a
817response is sent back.</p>
818</div>
819</div>
820<div class="section" id="using-associative-arrays-in-a-request-parameter">
821<h3><a class="toc-backref" href="#id18">Using Associative Arrays In a Request Parameter</a><a class="headerlink" href="#using-associative-arrays-in-a-request-parameter" title="Permalink to this headline"></a></h3>
822<p>If you wish to use an associative array in your method parameters you
823will need to use a struct datatype:</p>
824<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$request</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span>
825 <span class="k">array</span><span class="p">(</span>
826 <span class="c1">// Param 0</span>
827 <span class="k">array</span><span class="p">(</span><span class="s1">&#39;name&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;John&#39;</span><span class="p">),</span>
828 <span class="s1">&#39;struct&#39;</span>
829 <span class="p">),</span>
830 <span class="k">array</span><span class="p">(</span>
831 <span class="c1">// Param 1</span>
832 <span class="k">array</span><span class="p">(</span>
833 <span class="s1">&#39;size&#39;</span> <span class="o">=&gt;</span> <span class="s1">&#39;large&#39;</span><span class="p">,</span>
834 <span class="s1">&#39;shape&#39;</span><span class="o">=&gt;</span><span class="s1">&#39;round&#39;</span>
835 <span class="p">),</span>
836 <span class="s1">&#39;struct&#39;</span>
837 <span class="p">)</span>
838<span class="p">);</span>
839
840<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">request</span><span class="p">(</span><span class="nv">$request</span><span class="p">);</span>
841</pre></div>
842</div>
843<p>You can retrieve the associative array when processing the request in
844the Server.</p>
845<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$parameters</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">output_parameters</span><span class="p">();</span>
846<span class="nv">$name</span> <span class="o">=</span> <span class="nv">$parameters</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">&#39;name&#39;</span><span class="p">];</span>
847<span class="nv">$size</span> <span class="o">=</span> <span class="nv">$parameters</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">&#39;size&#39;</span><span class="p">];</span>
848<span class="nv">$shape</span> <span class="o">=</span> <span class="nv">$parameters</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="s1">&#39;shape&#39;</span><span class="p">];</span>
849</pre></div>
850</div>
851</div>
852<div class="section" id="id2">
853<h3><a class="toc-backref" href="#id19">Data Types</a><a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
854<p>According to the <a class="reference external" href="http://www.xmlrpc.com/spec">XML-RPC spec</a> there are
855seven types of values that you can send via XML-RPC:</p>
856<ul class="simple">
857<li><em>int</em> or <em>i4</em></li>
858<li><em>boolean</em></li>
859<li><em>string</em></li>
860<li><em>double</em></li>
861<li><em>dateTime.iso8601</em></li>
862<li><em>base64</em></li>
863<li><em>struct</em> (contains array of values)</li>
864<li><em>array</em> (contains array of values)</li>
865</ul>
866</div>
867</div>
868<div class="section" id="class-reference">
869<h2><a class="toc-backref" href="#id20">Class Reference</a><a class="headerlink" href="#class-reference" title="Permalink to this headline"></a></h2>
870<dl class="class">
871<dt id="CI_Xmlrpc">
872<em class="property">class </em><code class="descname">CI_Xmlrpc</code><a class="headerlink" href="#CI_Xmlrpc" title="Permalink to this definition"></a></dt>
873<dd><dl class="method">
874<dt id="CI_Xmlrpc::initialize">
875<code class="descname">initialize</code><span class="sig-paren">(</span><span class="optional">[</span><em>$config = array()</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::initialize" title="Permalink to this definition"></a></dt>
876<dd><table class="docutils field-list" frame="void" rules="none">
877<col class="field-name" />
878<col class="field-body" />
879<tbody valign="top">
880<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
881<li><strong>$config</strong> (<em>array</em>) – Configuration data</li>
882</ul>
883</td>
884</tr>
885<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
886</td>
887</tr>
888</tbody>
889</table>
890<p>Initializes the XML-RPC library. Accepts an associative array containing your settings.</p>
891</dd></dl>
892
893<dl class="method">
894<dt id="CI_Xmlrpc::server">
895<code class="descname">server</code><span class="sig-paren">(</span><em>$url</em><span class="optional">[</span>, <em>$port = 80</em><span class="optional">[</span>, <em>$proxy = FALSE</em><span class="optional">[</span>, <em>$proxy_port = 8080</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::server" title="Permalink to this definition"></a></dt>
896<dd><table class="docutils field-list" frame="void" rules="none">
897<col class="field-name" />
898<col class="field-body" />
899<tbody valign="top">
900<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
901<li><strong>$url</strong> (<em>string</em>) – XML-RPC server URL</li>
902<li><strong>$port</strong> (<em>int</em>) – Server port</li>
903<li><strong>$proxy</strong> (<em>string</em>) – Optional proxy</li>
904<li><strong>$proxy_port</strong> (<em>int</em>) – Proxy listening port</li>
905</ul>
906</td>
907</tr>
908<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
909</td>
910</tr>
911</tbody>
912</table>
913<p>Sets the URL and port number of the server to which a request is to be sent:</p>
914<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">server</span><span class="p">(</span><span class="s1">&#39;http://www.sometimes.com/pings.php&#39;</span><span class="p">,</span> <span class="mi">80</span><span class="p">);</span>
915</pre></div>
916</div>
917<p>Basic HTTP authentication is also supported, simply add it to the server URL:</p>
918<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">server</span><span class="p">(</span><span class="s1">&#39;http://user:pass@localhost/&#39;</span><span class="p">,</span> <span class="mi">80</span><span class="p">);</span>
919</pre></div>
920</div>
921</dd></dl>
922
923<dl class="method">
924<dt id="CI_Xmlrpc::timeout">
925<code class="descname">timeout</code><span class="sig-paren">(</span><em>$seconds = 5</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::timeout" title="Permalink to this definition"></a></dt>
926<dd><table class="docutils field-list" frame="void" rules="none">
927<col class="field-name" />
928<col class="field-body" />
929<tbody valign="top">
930<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
931<li><strong>$seconds</strong> (<em>int</em>) – Timeout in seconds</li>
932</ul>
933</td>
934</tr>
935<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
936</td>
937</tr>
938</tbody>
939</table>
940<p>Set a time out period (in seconds) after which the request will be canceled:</p>
941<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">timeout</span><span class="p">(</span><span class="mi">6</span><span class="p">);</span>
942</pre></div>
943</div>
944<p>This timeout period will be used both for an initial connection to
945the remote server, as well as for getting a response from it.
946Make sure you set the timeout before calling <code class="docutils literal"><span class="pre">send_request()</span></code>.</p>
947</dd></dl>
948
949<dl class="method">
950<dt id="CI_Xmlrpc::method">
951<code class="descname">method</code><span class="sig-paren">(</span><em>$function</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::method" title="Permalink to this definition"></a></dt>
952<dd><table class="docutils field-list" frame="void" rules="none">
953<col class="field-name" />
954<col class="field-body" />
955<tbody valign="top">
956<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
957<li><strong>$function</strong> (<em>string</em>) – Method name</li>
958</ul>
959</td>
960</tr>
961<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
962</td>
963</tr>
964</tbody>
965</table>
966<p>Sets the method that will be requested from the XML-RPC server:</p>
967<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">method</span><span class="p">(</span><span class="s1">&#39;method&#39;</span><span class="p">);</span>
968</pre></div>
969</div>
970<p>Where method is the name of the method.</p>
971</dd></dl>
972
973<dl class="method">
974<dt id="CI_Xmlrpc::request">
975<code class="descname">request</code><span class="sig-paren">(</span><em>$incoming</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::request" title="Permalink to this definition"></a></dt>
976<dd><table class="docutils field-list" frame="void" rules="none">
977<col class="field-name" />
978<col class="field-body" />
979<tbody valign="top">
980<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
981<li><strong>$incoming</strong> (<em>array</em>) – Request data</li>
982</ul>
983</td>
984</tr>
985<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">void</p>
986</td>
987</tr>
988</tbody>
989</table>
990<p>Takes an array of data and builds request to be sent to XML-RPC server:</p>
991<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$request</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="k">array</span><span class="p">(</span><span class="s1">&#39;My Photoblog&#39;</span><span class="p">,</span> <span class="s1">&#39;string&#39;</span><span class="p">),</span> <span class="s1">&#39;http://www.yoursite.com/photoblog/&#39;</span><span class="p">);</span>
992<span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">request</span><span class="p">(</span><span class="nv">$request</span><span class="p">);</span>
993</pre></div>
994</div>
995</dd></dl>
996
997<dl class="method">
998<dt id="CI_Xmlrpc::send_request">
999<code class="descname">send_request</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::send_request" title="Permalink to this definition"></a></dt>
1000<dd><table class="docutils field-list" frame="void" rules="none">
1001<col class="field-name" />
1002<col class="field-body" />
1003<tbody valign="top">
1004<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">TRUE on success, FALSE on failure</td>
1005</tr>
1006<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
1007</tr>
1008</tbody>
1009</table>
1010<p>The request sending method. Returns boolean TRUE or FALSE based on success for failure, enabling it to be used conditionally.</p>
1011</dd></dl>
1012
1013<dl class="method">
1014<dt id="CI_Xmlrpc::display_error">
1015<code class="descname">display_error</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::display_error" title="Permalink to this definition"></a></dt>
1016<dd><table class="docutils field-list" frame="void" rules="none">
1017<col class="field-name" />
1018<col class="field-body" />
1019<tbody valign="top">
1020<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Error message string</td>
1021</tr>
1022<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
1023</tr>
1024</tbody>
1025</table>
1026<p>Returns an error message as a string if your request failed for some reason.</p>
1027<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">echo</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">display_error</span><span class="p">();</span>
1028</pre></div>
1029</div>
1030</dd></dl>
1031
1032<dl class="method">
1033<dt id="CI_Xmlrpc::display_response">
1034<code class="descname">display_response</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::display_response" title="Permalink to this definition"></a></dt>
1035<dd><table class="docutils field-list" frame="void" rules="none">
1036<col class="field-name" />
1037<col class="field-body" />
1038<tbody valign="top">
1039<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Response</td>
1040</tr>
1041<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">mixed</td>
1042</tr>
1043</tbody>
1044</table>
1045<p>Returns the response from the remote server once request is received. The response will typically be an associative array.</p>
1046<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">display_response</span><span class="p">();</span>
1047</pre></div>
1048</div>
1049</dd></dl>
1050
1051<dl class="method">
1052<dt id="CI_Xmlrpc::send_error_message">
1053<code class="descname">send_error_message</code><span class="sig-paren">(</span><em>$number</em>, <em>$message</em><span class="sig-paren">)</span><a class="headerlink" href="#CI_Xmlrpc::send_error_message" title="Permalink to this definition"></a></dt>
1054<dd><table class="docutils field-list" frame="void" rules="none">
1055<col class="field-name" />
1056<col class="field-body" />
1057<tbody valign="top">
1058<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1059<li><strong>$number</strong> (<em>int</em>) – Error number</li>
1060<li><strong>$message</strong> (<em>string</em>) – Error message</li>
1061</ul>
1062</td>
1063</tr>
1064<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">XML_RPC_Response instance</p>
1065</td>
1066</tr>
1067<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">XML_RPC_Response</p>
1068</td>
1069</tr>
1070</tbody>
1071</table>
1072<p>This method lets you send an error message from your server to the client.
1073First parameter is the error number while the second parameter is the error message.</p>
1074<div class="highlight-ci"><div class="highlight"><pre><span></span><span class="k">return</span> <span class="nv">$this</span><span class="o">-&gt;</span><span class="na">xmlrpc</span><span class="o">-&gt;</span><span class="na">send_error_message</span><span class="p">(</span><span class="mi">123</span><span class="p">,</span> <span class="s1">&#39;Requested data not available&#39;</span><span class="p">);</span>
1075</pre></div>
1076</div>
1077</dd></dl>
1078
1079</dd></dl>
1080
1081</div>
1082</div>
1083
1084
1085 </div>
1086 <footer>
1087
1088 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
1089
1090 <a href="zip.html" class="btn btn-neutral float-right" title="Zip Encoding Class">Next <span class="fa fa-arrow-circle-right"></span></a>
1091
1092
1093 <a href="user_agent.html" class="btn btn-neutral" title="User Agent Class"><span class="fa fa-arrow-circle-left"></span> Previous</a>
1094
1095 </div>
1096
1097
1098 <hr/>
1099
1100 <div role="contentinfo">
1101 <p>
1102 &copy; Copyright 2014 - 2019, British Columbia Institute of Technology.
1103 Last updated on Jan 16, 2019.
1104 </p>
1105 </div>
1106
1107 Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
1108
1109</footer>
1110 </div>
1111 </div>
1112
1113 </section>
1114
1115 </div>
1116
1117
1118
1119
1120
1121 <script type="text/javascript">
1122 var DOCUMENTATION_OPTIONS = {
1123 URL_ROOT:'../',
1124 VERSION:'3.1.10',
1125 COLLAPSE_INDEX:false,
1126 FILE_SUFFIX:'.html',
1127 HAS_SOURCE: false
1128 };
1129 </script>
1130 <script type="text/javascript" src="../_static/jquery.js"></script>
1131 <script type="text/javascript" src="../_static/underscore.js"></script>
1132 <script type="text/javascript" src="../_static/doctools.js"></script>
1133
1134
1135
1136
1137
1138 <script type="text/javascript" src="../_static/js/theme.js"></script>
1139
1140
1141
1142
1143 <script type="text/javascript">
1144 jQuery(function () {
1145 SphinxRtdTheme.StickyNav.enable();
1146 });
1147 </script>
1148
1149
1150</body>
1151</html>