2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

removed documentation , as better to prepare a reference list with links to pluguns/ modiles included, moreover it's a part of Lime docs and workarounds

This commit is contained in:
Alex
2015-12-21 21:01:34 +03:00
parent 647755462c
commit 724bea7eee
81 changed files with 0 additions and 8285 deletions

View File

@@ -1,34 +0,0 @@
########################################
### Build process for phpCAS package ###
########################################
1. Prepare your own build config:
go to the utils/ dir and copy build-example.properties to a
build.properties file and adjust the path for all needed binaries. You need
at least php and doxygen for package creation. Git is needed as a developer with
commit priviledges and upload right for the distribution package.
2. Install necessary php packages:
Install the pear package PEAR_PackageFileManager2 via the command
"pear install PEAR_PackageFileManager2"
3. Run the "ant" tasks to build the phpCAS package and other developer tasks:
ant dist # create a local package
ant clean # clear local packages and temporary files
ant prepare # The default action, tags, packages, and commits to the local git repository
ant push # Push the new commits and tags to the origin repository (github)
ant upload # Upload to jasig
ant makeCurrentSymlink # Set the symbolic link on the jasig site for the most current packages
ant revert # To revert any "ant prepare" actions before they are pushed to the github repo
The ant prepare target is equivalent to ant tag && ant dist && ant markdev.
To revert the commits and tag additions added in the ant tag and ant markdev
targets, use the new ant revert target. This should not be done after pushing.
Running ant prepare is safe and can be followed by ant revert to get rid of the
added commits and tag in your local repository.

View File

@@ -1,565 +0,0 @@
Changes in version 1.3.4
Security Fixes:
Bug Fixes:
* Mark auth call completed for post-auth callback [#131] (Daniel Frett)
* Remove typo CAS_TypeMismatchException [#133] (Gabrijel Gavranović)
* Fix SERVER_ADMIN error for alternate Webservers [#103] (Joachim Fritschi)
* Fix non-strict string comparision in _isHttps check [#139] (Brandon Peters)
* Fix setNoCasServerValidation for cURL 7.10 [#122] (Joachim Fritschi)
* Fix renew support [#93] (Joachim Fritschi)
* _getClientUrl() fixes with reverse proxies [#154] adongy
* Param type doc should be 'string' in CAS::logoutWithRedirectService() [#167] Chris McCafferty
* Fix broken class reference [#161] Joachim Fritschi
Improvement:
* Add phpCAS::isInitialized() API method [#112] (Adam Franco)
* select temporary directory based on env vars [#136) (Geoffroy Desvernay)
* Add gitattributes to reduce unnecessary files from composer installs. [#141] (Jon Dufresne)
* Allow cas endpoint to be a 'get url' [#146] (flushbi)
* Add documentation for phpCAS::$_PHPCAS_CLIENT [#156] (Sylvain)
* Improve https check [#139] (Joachim Fritschi)
* Add time to trace [#158] (cwsterling)
* Add php5.6 tests, move to faster docker env [#169] (Florian Holzhauer)
* Introduce a setVerbose() toggle to prevent debug info leaking in production [#152 #147] (Joachim Fritschi)
Changes in version 1.3.3
Security Fixes:
* CVE-2014-4172 Urlencode all tickets [#125] (Marvin Addison)
Bug Fixes:
* Fix CURL compatibility CURL >= 7.28.0 [#66] (adoy)
* Commit session before redirect [#79] (kakawait)
* Fix warnings for php => 5.5 [87] (fh)
* Update wrong wording in examples [#90] (misilot)
* Fixed bug in imap.php [#105] (echampet)
* Fix missing Server_Admin variable for nginex [#121](arianf)
* Fix error in TypeMismatchException [#123 ](Develle)
* Fix bug in https test [#126] (Florent Baldino)
Improvement:
* Fix grammar of documentation [#61] (frett)
* Improved testability of the phpCAS client [#7] (Adam Franco)
* Fixed typo [#70] (fh)
* Example for improved cookie hardening [#67] (Joachim Fritschi)
* Added support for X-Forwarded-Proto Header [#77] (Paul Donohue)
* Added composer support [#73] (dhyde)
* Travis for continuous integration [#82] (fh)
* Support for X-Forwared-Port [#100] (neopeak)
* Support for CAS 3.0 protocol [#116] (fredrik-w)
Changes in version 1.3.2
Security Fixes:
* CVE-2012-5583 Missing CN validation of CAS server certificate [#58] (Joachim Fritschi)
Bug Fixes:
* Fix broken character encoding in Greek and French [#40] (Joachim Fritschi)
* Minor error corrections in a few example files [] (Joachim Fritschi)
* Remove erroneous break statement [#44] (jbittel)
* Use X-Forwarded-Port [#45] (Andrew Kirkpatrick)
* Stop autoloader using set_include_path [#51/#52] (drysdaleb)
* Fix undefined property in the rebroadcast code [#47] (Joachim Fritschi)
Improvement:
* Enable getCookies on a proxied sevices [#56] (Adam Franco)
Changes in version 1.3.1
Bug Fixes:
* Readd PEAR support to the package [#30] (Joachim Fritschi)
* fix a __autoload conflicts in the autoloader [#36] (Joachim Fritschi)
* fix PEAR code style errors [25] (Joachim Fritschi)
* properly unset variables during checkAuthenticate[#35] (Joachim Fritschi)
Changes in version 1.3.0
Improvements:
* enable single sign-out when session has already started [#29] (Benvii)
Changes in version 1.3.0RC1
Bug Fixes:
* the saml logout url should be parsed urlencoded [#24] (dlineate)
* fix a proxy mode bug introduced in a previous comitt [#16] (Adam Franco)
* Fix include_path order so that the phpCAS path takes precedence [#13] (Adam Franco)
* fix invalid characters in the php session naming [#17] (Joachim Fritschi)
* fix an initialisation problem introduced in the PGT storage [18] (Daniel Frett)
* make sure the PGTStorage object is initialized if a user is utilizing the createTable method [#4] (Daniel Frett)
* Fix error message in phpCAS::setCacheTimesForAuthRecheck() [PHPCAS-132/#1] (Bradley Froehle)
* Always return attributes in utf8 [PHPCAS-102]
* Fix warning during debugging if debug is set to false [PHPCAS-123] (Sean Watkins)
New Features:
* Add a script to create the PGT db table in proxy mode [#11] (Joachim Fritschi)
* Switch to the Apache License [#5] (Adam Franco, Joachim Fritschi)
* Move to github and add all necessary file to package [#12] (Adam Franco)
* New build process for github [#12] (Adam Franco)
* Update unit tests to work with the lastest phpunit version [PHPCAS-128] (Adam Franco)
* Refacatoring of the protocol decision making to allow validation of proxied usage [PHPCAS-69] (Joachim Fritschi, Adam Franco)
* Rebroadcast of logout and pgtiou to support clustered phpcas [PHPCAS-100] (Matthew Selwood, Adam Franco)
Improvements:
* Improved cookie handling [] (Adam Franco
* Indent, format and user name guidelines of PEAR [#14] (Joachim Fritschi)
* Add a class autoloading feature [PHPCAS-125/#8] (Joachim Fritschi)
* Remove global variables [PHPCAS-126] (Adam Franco)
* Implementation of an exception framework to allow gracefull termination [PHPCAS-109] (Joachim Fritschi)
Security Fixes:
* CVE-2012-1104 validate proxied usage of a service [PHPCAS-69] (Joachim Fritschi, Adam Franco)
* CVE-2012-1105 change the default PGT save path to the session storage path and set proper permissions [#22] (Joachim Fritschi)
Changes in version 1.2.2
Bug Fixes:
* Improve compatibility with php < 5.3 for E_USER_DEPRECATED [PHPCAS-116] (Hugh Eaves)
Changes in version 1.2.2RC1
Bug Fixes:
* CASClient::getURL() cannot be private [PHPCAS-103] (Joachim Fritschi)
* CASClient::getServerServiceValidateURL() doesn't respect existing query strings [PHPCAS-104] (Bradley Froehle, Joachim Fritschi)
* CASClient::retrievePT() must be a public function [PHPCAS-107] (Joachim Fritschi)
* Expose setNoClearTicketsFromUrl() to the client [PHPCAS-108] (Joachim Fritschi)
* Remove the PGT filestorage in xml format that is not implemented [PHPCAS-112] (Joachim Fritschi)
* Fix compatibility of the PGT db storage interface with postgres [PHPCAS-113] (Joachim Fritschi)
Improvement
* Support for proxied POST requests. [PHPCAS-90] (Adam Franco)
* Add missing example for the new pgt-db storage [PHPCAS-101] (Joachim Fritschi)
* CASClient::getServerLoginURL(): Don't cache gateway/renew parameters [PHPCAS-105] (Bradley Froehle)
* fix parsing of cookies with special symbols in their values [PHPCAS-106] (Joachim Fritschi)
* Removal of the debug_backtrace hack for php4 [PHPCAS-110] (Joachim Fritschi)
* Clean up the naming structure of the classes [PHPCAS-111] (Joachim Fritschi)
* Better debug log output format [PHPCAS-114] (Joachim Fritschi)
* Many more examples and one central config. Improved code documentation [PHPCAS-86] (Joachim Fritschi, Adam Franco)
Changes in version 1.2.1
* None
Changes in version 1.2.1RC1
Improvements
* add support for storing PGTs in a database [PHPCAS-94] (Daniel Frett)
Bug Fixes
* phpCAS::setDebug(FALSE) should stop logging [PHPCAS-95] (Joachim Fritschi)
* fix checkAuthenticate return value documentation [PHPCAS-92] (Joachim Fritschi)
* fix PGTStorage contructor name [PHPCAS-93] (Daniel Frett)
* fix the PHPCAS_SERVICE_NOT_AVAILABLE constant [PHPCAS-91] (Daniel Frett)
* fix redirection with multiple proxies in HTTP_X_FORWARDED_HOST [PHPCAS-98] (Joachim Fritschi)
* fix some undefinde variable warnings in debug mode [PHPCAS-96] (Joachim Fritschi)
Changes in version 1.2.0
* None
Changes in version 1.2.0RC2
Improvements
* add callback hooks during authentication and single sign-out [PHPCAS-76] (Adam Franco)
Changes in version 1.2.0RC1
Improvements
* add hasAttribute($key) and getAttribute($key) [PHPCAS-43] (Adam Franco)
* add unit tests for cas 2.0 attribute support [PHPCAS-88] (Adam Franco)
* expose the proxy chain through the phpcas interface [PHPCAS-89] (Adam Franco)
* add deprecation messages to the logout functions with an url parameter [PHPCAS-85] (Joachim Fritschi)
Bug Fixes
* fix public/private modifier for some functions [PHPCAS-87] (Joachim Fritschi)
Changes in version 1.2.0-beta1
Bug Fixes
* fix redirection behind a proxy. [PHPCAS-78] (Alex Barker)
* remove the bogus setCasServerCert() function and clean up the curl ssl settings [PHPCAS-84] (Joachim Fritschi)
Improvements
* mark the logout functions with an url parameter a deprecated [PHPCAS-85] (Joachim Fritschi)
* add public/private modifier for all vars and functions [PHPCAS-77] (Joachim Fritschi)
* add a testing framwork that implement on and offline testing capabilities [PHPCAS-66] (Adam Franco)
* add RFC compliant cookie storage for the proxy() mode. [PHPCAS-54] (Adam Franco)
* removal of the domxml compatibility lib [PHPCAS-72] (Matthew Brooks, Joachim Fritschi)
* add support for attributes for the cas_2.0 protocol [PHPCAS-43] (Joachim Fritschi, Adam Franco)
* removal of unused code and comments [PHPCAS-63] (Joachim Fritschi)
* fix static function warnings for php 5.x [PHPCAS-46] (Joachim Fritschi)
Changes in version 1.1.3
Bug Fixes
* removal of the non functional pgt-db backend [PHPCAS-65] (Joachim Fritschi)
Changes in version 1.1.3RC1
Security Issue
* CVE-2010-3690 phpCAS: XSS during a proxy callback [PHPCAS-80] (Joachim Fritschi)
* CVE-2010-3691 phpCAS: prevent symlink attacks during a proxy callback [PHPCAS-80] (Joachim Fritschi)
* CVE-2010-3692 phpCAS: directory traversal during a proxy callback [PHPCAS-80] (Joachim Fritschi)
Bug Fixes
* fix missing $this in domxml-php4-to-php5 [PHPCAS-73] (Iñaki Arenaza)
* fix broken redirection with safari [PHPCAS-79] (Alex Barker)
* fix missing exit() call during ticket validation [PHPCAS-76] (Igor Blanco,Joachim Fritschi)
* fix a notice because REQUEST_URL is not defined on IIS [PHPCAS-81] (Iñaki Arenaza)
* fix a typo in pgt-db.php [PHPCAS-75] (Julien Cochennec)
Improvements
* upgrade domxml-php4-to-php5 to the newest version [PHPCAS-74] (Joachim Fritschi)
Changes in version 1.1.2
* None
Changes in version 1.1.2RC2
Bug Fixes
* Prevent domxml-php4-to-php5 to be inclueded twice [PHPCAS-48] (Brad Krane)
Changes in version 1.1.2RC1
Security Issue
* Fix a session hijacking hole CVE-2010-2795 [PHPCAS-61] (Joachim Fritschi)
* callbackurl in proxy mode should be urlencoded CVE-2010-2796 [PHPCAS-67] (Joachim Fritschi)
Improvement
* Debuglog contains phpCAS version information [PHPCAS-62] (Joachim Fritschi)
Bug Fixes
* Fix warnings for SAML responses without attributes [PHPCAS-59] (Joachim Fritschi)
* Fix duplicate SAML debug output [PHPCAS-64] (Joachim Fritschi)
* Providing a new ST/PT/SA during an authenticated session will be ignored
and a warning will be issued to the debug log. [PHPCAS-61] (Joachim Fritschi)
* fix 2 undefinded variable notices in serviceWeb() [PHPCAS-68] (Joachim Fritschi)
Changes in version 1.1.1
Improvement
* On Single Sign Out destroy any existing application session before deleting the phpcas session [PHPCAS-58] (Joachim Fritschi)
Changes in version 1.1.1RC2
Bug fixes
* Fix bug in handling urls containing parameters without values [PHPCAS-57] (Joe Lencioni)
* New XSS patch for PHPCAS-52 that was undone in r48507 [PHPCAS-57] (Joachim Fritschi)
Changes in version 1.1.1RC1
Bug fixes
* Fix bug in restoring an existing session [PHPCAS-55] (Joachim Fritschi)
Changes in version 1.1.0
Improvement
* Replace deprecated split() with explode(). [PHPCAS-42] (Joe Lencioni)
Changes in version 1.1.0RC8
Bug fixes
* Add additional comments regarding the use of serviceValidate and proxyValdiate [PHPCAS-44] (Joachim Fritschi)
* Revert all changes made to the ticket parsing in r47347 r48210 [PHPCAS-44] (Joachim Fritschi)
* Fix warning when destroying uninitialized session [PHPCAS-53] (Yann Richard,Joachim Fritschi)
Changes in version 1.1.0RC7
Security fixes
* Fix XSS Vulnerability. Sanatize parameters before using the url submitted by a client [PHPCAS-52] (Joachim Fritschi)
Changes in version 1.1.0RC6
Bug fixes
* restore any possible old session before renaming the session [PHPCAS-50] (Joachim Fritschi)
Changes in version 1.1.0RC5
Bug fixes
* fixed don't destroy existing sessions unless needed, more debug output [PHPCAS-50] (Joachim Fritschi)
Changes in version 1.1.0RC4
Bug fixes
* fixed use PHP4 functions to parse saml11 attributes [PHPCAS-51] (Joachim Fritschi)
Changes in version 1.1.0RC3
Bug fixes
* added a check for missing params [PHPCAS-42] (Joachim Fritschi)
Changes in version 1.1.0RC2
New features
* added custom validation Urls [PHPCAS-45] (Joachim Fritschi).
Bug fixes
* fixed PGT DB storage parameter list [PHPCAS-47] (Paul Merchant, Jr.)
* fixed parsing of STs [PHPCAS-44] (Joachim Fritschi)
* fixed session initialisation [PHPCAS-50] (Joachim Fritschi)
* fixed urls with than one query parameter [PHPCAS-42] (Caio Chassot)
Changes in version 1.1.0RC1
New features
* added SAML support [PHPCAS-40] (Brian Long and Matthias Crauwels).
Bug fixes
* fixed invalid validation URLs [PHPCAS-39] (Alex Danieli).
* removed old PHP4 references [PHPCAS-41] (Yann Richard).
* fixed curl options [PHPCAS-38] (Andy Cowling).
Improvement
* added accept IP addresses for allowed clients [PHPCAS-37] (Arunas Stockus)
Changes in version 1.0.2RC1
Bug fixes
* fix redirections masking error messages [PHPCAS-36] (Olivier Berger)
* fixed validatePGT() failing on phpCAS::traceBegin() with newer domxml-php4-to-php5.php [PHPCAS-35] (Olivier Berger)
* Fixed missing exit() at end of callback() method [PHPCAS-34] (Olivier Berger)
* Update included domxml-php4-php5.php to most recent version now under LGPL [PHPCAS-30] (Olivier Berger)
* fixed empty $target_service in CAS_Client:serviceMail [PHPCAS-22] (Julien Marchal).
Changes in version 1.0.1
Bug fixes
* fixed PEAR base install directory [PHPCAS-28] (Brett Bieber).
* fixed illegal characters in session id [PHPCAS-29] (Michael Ströder, Brett Bieber).
* fixed refresh with ticket causes authentication failure [related to PHPCAS-27] (Brett Bieber).
* fixed conflict with custom session handlers [PHPCAS-26] (Martin Gonzalez).
Changes in version 1.0.0
New features
* phpCAS is now PEAR-installable (Brett Bieber).
* added method handleLogoutRequests() to handle logout requests incoming from the CAS server (Julien Marchal and Pascal Aubry, requested by Craig Andrews).
* added methods setHttpProxy(), setNetworkInterface() and setExtraCurlOptions() (Stéphane Gully).
Enhancements
* removed undesirable notice (Glennie Vignarajah).
* removed PEAR DB dependency when storing PGTs to the filesytem (Stéphane Gully).
Changes in version 0.6.0
New features
* added methods setCasServerCert() and setCasServerCaCert() to authenticate the CAS server, and method setNoCasServerValidation() to skip the SSL checks (Pascal Aubry, requested by Andrew Petro).
* Added spanish and catalan translations (Ivan Garcia).
Bug fix
* fixed PGT storage path on Windows (Olivier Thebault).
Changes in version 0.5.1
New features
* restored method isAuthenticated() (Julien Marchal).
Changes in version 0.5.0
New features
* added japanese translation (Noriyuki Fukuoka).
* added german translation (Henrik Genssen).
* phpCAS now works for CAS v3 proxy tickets (Matt Zukowski).
* phpCAS now also works with lighttpd (Marvin Addison)
Bug fixes
* fixed method setHTMLFooter() (Noriyuki Fukuoka).
* fixed method setHTMLHeader() (Xavier Castanho).
* fixed method isHttps() (Henrik Genssen).
* fixed method PGTStorageDB() (Ray Lambe).
* encode all the parameters, not only '&' characters (Matthew Debus).
* fixed ST proxy tickets (Julien Marchal).
Changes in version 0.4.23
Enhancement
* removed notice messages (David Lowry).
Changes in version 0.4.22
Bug fix
* added default value for parameter gateway in methods setServerLoginUrl() and redirectToCas() (Velpi).
New Feature
* added method isSessionAuthenticated() (Brendan Arnold).
Other change
* removed the call to error_reporting() to allow the configuration of error reporting at server level (Pascal Aubry, requested by Sylvain Derosiaux).
Changes in version 0.4.21
Bug fix
* some URLs were ill-formed in some rare circumstances (Jérôme Andrieux).
New Feature
* added methods setServerLoginURL() and setServerLogoutURL() (Wyman Chan).
Changes in version 0.4.20
New feature
* phpCAS::checkAuthentication() implements the gateway feature of CAS (Pascal Aubry, requested by Romuald Lorthioir).
Other change
* phpCAS::authenticateIfNeeded() was renamed phpCAS::forceAuthentication() (Pascal Aubry).
Changes in version 0.4.19
New features
* the service URL for the CAs server can be fixed with method phpCAS::setFixedServiceURL (Julien Marchal).
* the callback URL used to receive PGTs can be fixed with method phpCAS::setFixedCallbackURL() (Julien Marchal).
* added a CAS_Client wrapper to class phpCAS for method retrievePGT() (Julien Marchal).
Changes in version 0.4.18
Bug fixes
* debugging information was missing (Alexandre Boisseau).
* used an undefined variable in pgt-file.php (Alexandre Boisseau).
Changes in version 0.4.17
Enhancement
* made phpCAS PHP5 compliant (Vangelis Haniotakis).
Changes in version 0.4.16
Enhancement
* added the possibility not to start the session management (Vangelis Haniotakis).
Changes in version 0.4.15
Enhancement
* added a hack to make phpCAS work with IIS (Vangelis Haniotakis).
Changes in version 0.4.14
Enhancement
* a URL can be given to the CAS server on logout (Sébastien Gougeon and Yann Richard).
Changes in version 0.4.13
Bug fix
* Removed infinite loop in debug mode (Robert Legros).
Changes in version 0.4.12
Enhancement
* phpCAS now works even if the web server does not set SERVER_NAME, by relying on HTTP_HOST (Terence Chiu).
Changes in version 0.4.11
Bug fix
* A typo prevented ticket validation to work correctly (Robert Legros).
Changes in version 0.4.10
Enhancement
* phpCAS was previously working with PHP >= 4.3.0. A debug_backtrace() wrapper was added and get_elements_by_tagname() calls were modified to make phpCAS work with phpCAS >= 4.2.2 (Robert Legros).
Changes in version 0.4.9
New features
* Added greek translation (Haniotakis Vangelis).
Changes in version 0.4.8
Enhancements
* PEAR's DB.php inclusion is done only if a DB class was not already included. This eases the integration into some stand-alone tools that already include DB.php, like Tikiwiki (Pascal Aubry, requested by Terence Chiu).
Changes in version 0.4.7
Enhancements
* PHP session is now destroyed when using the phpCAS::logout() method (Pascal Aubry, requested by Ruben Recaba).
* Call getenv() whenever possible instead of directly dealing with environment variables (with $_ENV['xxx']), as $_ENV is not available par default on some Windows systems (Pascal Aubry).
* Set error reporting level to E_ALL ~ E_NOTICE (Pascal Aubry).
* Added the release number in the name of the main directory of the zip distribution file (Pascal Aubry, requested by Vincent Mathieu).
* Explicitly set certificate control to get round with different curl default configurations (Wyman Chan).
Changes in version 0.4.6
Security bug fix
* Credentials given to HTTP realms were given in the service URLs to the CAS server (Julien Marchal).
Enhancements
* phpCAS now works behind an Apache reverse proxy (Julien Marchal).
Changes in version 0.4.5
Enhancements
* Developer releasing is now made by ant (Pascal Aubry).
Bug fixes
* CAS/PGTStorage files have been renamed to fit to Windows case insensitivity (Pascal Aubry);
* %TMP% and %TEMP% environment variables are now taken into account to set the location of the log file (Pascal Aubry).
Changes in version 0.4.4
Enhancement
* ticket retrieval and validation is now made with curl (Pascal Aubry).
Changes in version 0.4.3
Bug fix
* phpCAS was not exiting right after redirecting in callback mode (Julien Marchal)
Changes in version 0.4.2
New features
* Authentication checking is not necessarily redirecting to the CAS server (introduced phpCAS::isAuthenticated()) (Pascal Aubry)
* phpCAS can now be used to access IMAP/POP3/NNTP services (cf phpCAS::serviceMail()) (Pascal Aubry)
Enhancements
* debugging informations has been improved and is now send to a separate file (/tmp/phpCAS.log by default, can be changed by phpCAS::setDebug()) (Pascal Aubry)
Changes
* phpCAS::authenticate() is replaced by phpCAS::authenticateIfNeeded() (semantics unchanged) (Pascal Aubry)
* phpCAS::service() is replaced by phpCAS::serviceWeb() (semantics unchanged) (Pascal Aubry)
* phpCAS::setDebug() accepts FALSE (to stop debugging) or the name of a file (to log informations) (Pascal Aubry)
Changes in version 0.4.1
New features
* Sessionning between CAS proxies and services (Pascal Aubry)
Changes in version 0.4
New features
* CAS proxies can be chained (Pascal Aubry)
* improved error printing and debugging (introduced phpCAS::error()) (Pascal Aubry)
Enhancements
* proxy parameter removed from phpCAS::client() and introduced phpCAS::proxy() (Pascal Aubry)
* moved history from CAS/doc.php to history.php (create_version script updated accordingly) (Pascal Aubry)
* improved type-checking and controls for phpCAS methods (Pascal Aubry)
Changes in version 0.3.2
New features
* CAS proxies now work with HTTP (HTTPS only used for callbacks) (Pascal Aubry)
Changes in version 0.3.1
Bug fixes
* syntax error in CAS/Client.php (Julien Marchal)
Changes in version 0.3
New features
* CAS proxies are now supported (but no PGT retrieving for proxied client) (Pascal Aubry)
* introduced phpCAS container (Pascal Aubry)
Bug fixes
* CAS_LANG_DEFAULT is now taken into account (Pascal Aubry)
TODO
* support for PGT storage to databases (Pascal Aubry)
* PGT retrieving for proxied clients (Pascal Aubry)
Version 0.2
Features (Pascal Aubry)
* `Basic' (1.0) CAS mechanism supported (CAS proxies not implemented)
* Support for CAS versions 1.0 and 2.0 URL's
* Debug mode
* Customization of all output pages
* Internationalization (english and french, looking for translators...)

View File

@@ -1,100 +0,0 @@
################################
### Upgrading 1.3.1 -> 1.3.2 ###
################################
Due to the missing validation of the CN of the SSL certifcate it may be that
phpcas fails validation of CAS server certicates that do not match the IP/DNS
name you use in the phpcas client() or proxy() setup.
If this happens a quick workaround to change the setup to the old but unsecure
behaviour. This can be seen in the no_ssl_cn_validation example.
This is not a recommended setting and is no a secure setup!
################################
### Upgrading 1.2.x -> 1.3.0 ###
################################
------------------------------------------------------------------
1. Changing of the default debug.log permissions:
------------------------------------------------------------------
The default debug log is now created with 0600 permissions to be only readable
by the webserver
-------------------------------------------------------
2. Changing of the behaviour of proxied applications:
-------------------------------------------------------
If your application is being proxied (Another casified application is using
proxy tickets to access your service you need to change your configuration. The
new default configuration is now to deny any proxied use of your service unless
it is exlicitly allowed:
If you want your service to be proxied you have to enable it (default disabled)
and define an accepable list of proxies that are allowed to proxy your service.
Add each allowed proxy definition object. For the normal CAS_ProxyChain
class, the constructor takes an array of proxies to match. The list is in
reverse just as seen from the service. Proxies have to be defined in reverse
from the service to the user. If a user hits service A and gets proxied via
B to service C the list of acceptable on C would be array(B,A). The definition
of an individual proxy can be either a string or a regexp (preg_match is used)
that will be matched against the proxy list supplied by the cas server
when validating the proxy tickets. The strings are compared starting from
the beginning and must fully match with the proxies in the list.
Examples:
phpCAS::allowProxyChain(new CAS_ProxyChain(array(
'https://app.example.com/'
)));
or
phpCAS::allowProxyChain(new CAS_ProxyChain(array(
'/^https:\/\/app[0-9]\.example\.com\/rest\//',
'http://client.example.com/'
)));
For quick testing or in certain production screnarios you might want to
allow allow any other valid service to proxy your service. To do so, add
the "Any" chain:
phpcas::allowProxyChain(new CAS_ProxyChain_Any);
THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
ON THIS SERVICE.
----------------------------------------------------------------
3. Changing of the default PGT file storage location in proxy mode:
----------------------------------------------------------------
The default storage of the sensitive PGT session files is the
session_save_path() now. This is a php environment dependent dir which is also
used for storing your php session data. The default permissions are also changed
to 0600 to be only readable by the webserver.
------------------------------------------------------------------
4. The setPGTStorageFile() function has changed it parameters.
------------------------------------------------------------------
The setPGTStorageFile() function no longer needs an storage "format" argument.
Since the format functionality was never implemented it has now been dropped
and only the path argument is necessary.
------------------------------------------------------------------
5. The startSession boolean in the constructor has been changed to
changeSessionID
------------------------------------------------------------------
The last parameter of the constructor for has been changed from "start session"
to "change session ID". This has no negative effects on existion integrations
but will allow integration with other frameworks to take advantage of single
sign-out if they switch to "true". phpCAS will then rename the session id
(keeping all vars) and be able to single sign-out users.

View File

@@ -1,104 +0,0 @@
<?php
/**
* The purpose of this central config file is configuring all examples
* in one place with minimal work for your working environment
* Just configure all the items in this config according to your environment
* and rename the file to config.php
*
* PHP Version 5
*
* @file config.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
$phpcas_path = '../../source/';
///////////////////////////////////////
// Basic Config of the phpCAS client //
///////////////////////////////////////
// Full Hostname of your CAS Server
$cas_host = 'cas.example.com';
// Context of the CAS Server
$cas_context = '/cas';
// Port of your CAS server. Normally for a https server it's 443
$cas_port = 443;
// Path to the ca chain that issued the cas server certificate
$cas_server_ca_cert_path = '/path/to/cachain.pem';
//////////////////////////////////////////
// Advanced Config for special purposes //
//////////////////////////////////////////
// The "real" hosts of clustered cas server that send SAML logout messages
// Assumes the cas server is load balanced across multiple hosts
$cas_real_hosts = array('cas-real-1.example.com', 'cas-real-2.example.com');
// Client config for cookie hardening
$client_domain = '127.0.0.1';
$client_path = 'phpcas';
$client_secure = true;
$client_httpOnly = true;
$client_lifetime = 0;
// Database config for PGT Storage
$db = 'pgsql:host=localhost;dbname=phpcas';
//$db = 'mysql:host=localhost;dbname=phpcas';
$db_user = 'phpcasuser';
$db_password = 'mysupersecretpass';
$db_table = 'phpcastabel';
$driver_options = '';
///////////////////////////////////////////
// End Configuration -- Don't edit below //
///////////////////////////////////////////
// Generating the URLS for the local cas example services for proxy testing
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$curbase = 'https://' . $_SERVER['SERVER_NAME'];
} else {
$curbase = 'http://' . $_SERVER['SERVER_NAME'];
}
if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
$curbase .= ':' . $_SERVER['SERVER_PORT'];
}
$curdir = dirname($_SERVER['REQUEST_URI']) . "/";
// CAS client nodes for rebroadcasting pgtIou/pgtId and logoutRequest
$rebroadcast_node_1 = 'http://cas-client-1.example.com';
$rebroadcast_node_2 = 'http://cas-client-2.example.com';
// access to a single service
$serviceUrl = $curbase . $curdir . 'example_service.php';
// access to a second service
$serviceUrl2 = $curbase . $curdir . 'example_service_that_proxies.php';
$pgtBase = preg_quote(preg_replace('/^http:/', 'https:', $curbase . $curdir), '/');
$pgtUrlRegexp = '/^' . $pgtBase . '.*$/';
$cas_url = 'https://' . $cas_host;
if ($cas_port != '443') {
$cas_url = $cas_url . ':' . $cas_port;
}
$cas_url = $cas_url . $cas_context;
// Set the session-name to be unique to the current script so that the client script
// doesn't share its session with a proxied script.
// This is just useful when running the example code, but not normally.
session_name(
'session_for:'
. preg_replace('/[^a-z0-9-]/i', '_', basename($_SERVER['SCRIPT_NAME']))
);
// Set an UTF-8 encoding header for internation characters (User attributes)
header('Content-Type: text/html; charset=utf-8');
?>

View File

@@ -1,53 +0,0 @@
<?php
/**
* Script that generates a default table for PGT/PGTiou storage. This script
* assumes a database with proper permissions exists and we are habe
* permissions to create a table.
* All database settings have to be set in the config.php file. Or the
* CAS_PGTStorage_Db() options:
* $db, $db_user, $db_password, $db_table, $driver_options
* have to filled out directly. Option examples can be found in the
* config.example.php
*
* PHP Version 5
*
* @file create_pgt_storage_table.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Dummy client because we need a 'client' object
$client = new CAS_Client(
CAS_VERSION_2_0, true, $cas_host, $cas_port, $cas_context, false
);
// Set the torage object
$cas_obj = new CAS_PGTStorage_Db(
$client, $db, $db_user, $db_password, $db_table, $driver_options
);
$cas_obj->init();
$cas_obj->createTable();
?>
<html>
<head>
<title>phpCAS PGT db storage table creation</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<div class="success">
<?php
echo 'Table <b>' . $db_table . '</b> successfully created in database <b>' . $db . '</b>';
?>
</div>
</body>
</html>

View File

@@ -1,10 +0,0 @@
.error {
border: 1px solid #aa0000;
color: #aa0000;
padding: 5px;
}
.success {
border: 1px solid #00aa00;
color: #00aa00;
padding: 5px;
}

View File

@@ -1,82 +0,0 @@
<?php
/**
* Advanced example for SAML with attributes and single logout
*
* PHP Version 5
*
* @file example_advanced_saml11.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(SAML_VERSION_1_1, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
// phpCAS::setNoCasServerValidation();
// Handle SAML logout requests that emanate from the CAS host exclusively.
// Failure to restrict SAML logout requests to authorized hosts could
// allow denial of service attacks where at the least the server is
// tied up parsing bogus XML messages.
phpCAS::handleLogoutRequests(true, $cas_real_hosts);
// Force CAS authentication on any page that includes this file
phpCAS::forceAuthentication();
// Some small code triggered by the logout button
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
?>
<html>
<head>
<title>Advanced SAML 1.1 example</title>
</head>
<body>
<h2>Advanced SAML 1.1 example</h2>
<?php require 'script_info.php' ?>
Authentication succeeded for user
<strong><?php echo phpCAS::getUser(); ?></strong>.
<h3>User Attributes</h3>
<ul>
<?php
foreach (phpCAS::getAttributes() as $key => $value) {
if (is_array($value)) {
echo '<li>', $key, ':<ol>';
foreach ($value as $item) {
echo '<li><strong>', $item, '</strong></li>';
}
echo '</ol></li>';
} else {
echo '<li>', $key, ': <strong>', $value, '</strong></li>' . PHP_EOL;
}
}
?>
</ul>
<p><a href="?logout=">Logout</a></p>
</body>
</html>

View File

@@ -1,70 +0,0 @@
<?php
/**
* Example for overriding validation urls
*
* PHP Version 5
*
* @file example_custom_urls.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// Override the validation url for any (ST and PT) CAS 2.0 validation
phpCAS::setServerProxyValidateURL('https://cas.example.org:1443/proxyValidate');
// Override the validation url for any CAS 1.0 validation
//phpCAS::setServerServiceValidateURL('https://cas.example.org:1443/serviceValidate');
//Override the validation url for any SAML11 validation
//phpCAS::setServerSamlValidateURL('https://cas.example.org:1443/samlValidate');
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
<p><a href="?logout=">Logout</a></p>
</body>
</html>

View File

@@ -1,71 +0,0 @@
<?php
/**
* Example that uses the CAS gateway feature
*
* PHP Version 5
*
* @file example_gateway.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
if (isset($_REQUEST['login'])) {
phpCAS::forceAuthentication();
}
// check CAS authentication
$auth = phpCAS::checkAuthentication();
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<?php
if ($auth) {
// for this test, simply print that the authentication was successfull
?>
<h1>Successfull Authentication!</h1>
<?php include 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p><a href="?logout=">Logout</a></p><?php
} else {
?>
<h1>Guest mode</h1>
<p><a href="?login=">Login</a></p><?php
}
?>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
</body>
</html>

View File

@@ -1,85 +0,0 @@
<?php
/**
* Advanced example for hardening the phpcas client
*
* PHP Version 5
*
* @file example_hardening.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(false);
// Harden session cookie to prevent some attacks on the cookie (e.g. XSS)
session_set_cookie_params($client_lifetime, $client_path, $client_domain, $client_secure, $client_httpOnly);
// Initialize phpCAS
phpCAS::client(SAML_VERSION_1_1, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
// phpCAS::setNoCasServerValidation();
// Handle SAML logout requests that emanate from the CAS host exclusively.
// Failure to restrict SAML logout requests to authorized hosts could
// allow denial of service attacks where at the least the server is
// tied up parsing bogus XML messages.
phpCAS::handleLogoutRequests(true, $cas_real_hosts);
// Force CAS authentication on any page that includes this file
phpCAS::forceAuthentication();
// Some small code triggered by the logout button
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
?>
<html>
<head>
<title>Advanced SAML 1.1 example</title>
</head>
<body>
<h2>Advanced SAML 1.1 example</h2>
<?php require 'script_info.php' ?>
Authentication succeeded for user
<strong><?php echo phpCAS::getUser(); ?></strong>.
<h3>User Attributes</h3>
<ul>
<?php
foreach (phpCAS::getAttributes() as $key => $value) {
if (is_array($value)) {
echo '<li>', $key, ':<ol>';
foreach ($value as $item) {
echo '<li><strong>', $item, '</strong></li>';
}
echo '</ol></li>';
} else {
echo '<li>', $key, ': <strong>', $value, '</strong></li>' . PHP_EOL;
}
}
?>
</ul>
<p><a href="?logout=">Logout</a></p>
</body>
</html>

View File

@@ -1,76 +0,0 @@
<?php
/**
* Example that changes html of phpcas messages
*
* PHP Version 5
*
* @file example_html.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// customize HTML output
phpCAS::setHTMLHeader(
'<html>
<head>
<title>__TITLE__</title>
</head>
<body>
<h1>__TITLE__</h1>'
);
phpCAS::setHTMLFooter(
'<hr>
<address>
phpCAS __PHPCAS_VERSION__,
CAS __CAS_VERSION__ (__SERVER_BASE_URL__)
</address>
</body>
</html>'
);
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client with HTML output customization</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
</body>
</html>

View File

@@ -1,63 +0,0 @@
<?php
/**
* Example that changes language of phpcas pages
*
* PHP Version 5
*
* @file example_lang.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// set the language to french
phpCAS::setLang(PHPCAS_LANG_FRENCH);
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>Exemple d'internationalisation de phpCAS</title>
</head>
<body>
<h1>Authentification r&eacute;ussie&nbsp;!</h1>
<?php require 'script_info.php' ?>
<p>L'utilisateur connect&eacute; est <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>La version de phpCAS est <b><?php echo phpCAS::getVersion(); ?></b>.</p>
</body>
</html>

View File

@@ -1,64 +0,0 @@
<?php
/**
* Example for handling logout requests
*
* PHP Version 5
*
* @file example_logout.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// handle incoming logout requests
phpCAS::handleLogoutRequests();
// Or as an advanced featue handle SAML logout requests that emanate from the
// CAS host exclusively.
// Failure to restrict SAML logout requests to authorized hosts could
// allow denial of service attacks where at the least the server is
// tied up parsing bogus XML messages.
// phpCAS::handleLogoutRequests(true, $cas_real_hosts);
// force CAS authentication
phpCAS::forceAuthentication();
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
</body>
</html>

View File

@@ -1,68 +0,0 @@
<?php
/**
* Example for diabling SSL CN valdiation
*
* PHP Version 5
*
* @file example_simple.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
// phpCAS::setNoCasServerValidation();
// You can also disable the validation of the certficate CN. This means the
// certificate must be valid but the CN of the certificate must not match the
// IP or hostname you are using to access the server
phpCAS::setCasServerCACert($cas_server_ca_cert_path, false);
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
<p><a href="?logout=">Logout</a></p>
</body>
</html>

View File

@@ -1,74 +0,0 @@
<?php
/**
* Example that changes the storage of the pgt tickets
*
* PHP Version 5
*
* @file example_pgt_storage_db.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// set PGT storage to file in plain format in the same directory as session files
phpCAS::setPGTStorageDB($db, $db_user, $db_password, $db_table);
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
?>
<html>
<head>
<title>phpCAS proxy example with PGT storage to a database</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>phpCAS proxy example with PGT storage to file</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<h2>Response from service <?php echo $serviceUrl; ?></h2>
<?php
flush();
// call a service and change the color depending on the result
if (phpCAS::serviceWeb($serviceUrl, $err_code, $output)) {
echo '<div class="success">';
} else {
echo '<div class="error">';
}
echo $output;
echo '</div>';
?>
</body>
</html>

View File

@@ -1,74 +0,0 @@
<?php
/**
* Example that changes the storage of the pgt tickets to file
*
* PHP Version 5
*
* @file example_pgt_storage_db.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// set PGT storage to file in plain format in the same directory as session files
phpCAS::setPGTStorageFile(session_save_path());
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
?>
<html>
<head>
<title>phpCAS proxy example with PGT storage to file</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>phpCAS proxy example with PGT storage to file</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<h2>Response from service <?php echo $serviceUrl; ?></h2>
<?php
flush();
// call a service and change the color depending on the result
if ( phpCAS::serviceWeb($serviceUrl, $err_code, $output) ) {
echo '<div class="success">';
} else {
echo '<div class="error">';
}
echo $output;
echo '</div>';
?>
</body>
</html>

View File

@@ -1,98 +0,0 @@
<?php
/**
* Example for a proxy that makes a GET request.
*
* PHP Version 5
*
* @file example_proxy_GET.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
?>
<html>
<head>
<title>phpCAS proxy example #2</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>phpCAS proxied proxy example</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<h2>Response from service <?php echo $serviceUrl; ?></h2>
<?php
flush();
// call a service and change the color depending on the result
try {
$service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_GET);
$service->setUrl($serviceUrl);
$service->send();
if ($service->getResponseStatusCode() == 200) {
echo '<div class="success">';
echo $service->getResponseBody();
echo '</div>';
} else {
// The service responded with an error code 404, 500, etc.
echo '<div class="error">';
echo 'The service responded with a '
. $service->getResponseStatusCode() . ' error.';
echo '</div>';
}
} catch (CAS_ProxyTicketException $e) {
if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE) {
echo '<div class="error">';
echo "Your login has timed out. You need to log in again.";
echo '</div>';
} else {
// Other proxy ticket errors are from bad request format (shouldn't happen)
// or CAS server failure (unlikely) so lets just stop if we hit those.
throw $e;
}
} catch (CAS_ProxiedService_Exception $e) {
// Something prevented the service request from being sent or received.
// We didn't even get a valid error response (404, 500, etc), so this
// might be caused by a network error or a DNS resolution failure.
// We could handle it in some way, but for now we will just stop.
throw $e;
}
?>
</body>
</html>

View File

@@ -1,103 +0,0 @@
<?php
/**
* Example for a proxy that makes a POST request.
*
* PHP Version 5
*
* @file example_proxy_POST.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
$serviceUrl = $curbase . $curdir . 'example_service_POST.php';
?>
<html>
<head>
<title>phpCAS proxy POST example</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>phpCAS proxy POST example</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<h2>Response from service <?php echo $serviceUrl; ?></h2>
<?php
flush();
// call a service and change the color depending on the result
try {
$service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_POST);
$service->setUrl($serviceUrl);
$service->setContentType('application/x-www-form-urlencoded');
$service->setBody('favorite_color=blue');
$service->send();
if ($service->getResponseStatusCode() == 200) {
echo '<div class="success">';
echo $service->getResponseBody();
echo '</div>';
} else {
// The service responded with an error code 404, 500, etc.
echo '<div class="error">';
echo 'The service responded with a '
. $service->getResponseStatusCode() . ' error.';
echo $service->getResponseBody();
echo '</div>';
}
} catch (CAS_ProxyTicketException $e) {
if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE) {
echo '<div class="error">';
echo "Your login has timed out. You need to log in again.";
echo '</div>';
} else {
// Other proxy ticket errors are from bad request format (shouldn't happen)
// or CAS server failure (unlikely) so lets just stop if we hit those.
throw $e;
}
} catch (CAS_ProxiedService_Exception $e) {
// Something prevented the service request from being sent or received.
// We didn't even get a valid error response (404, 500, etc), so this
// might be caused by a network error or a DNS resolution failure.
// We could handle it in some way, but for now we will just stop.
throw $e;
}
?>
</body>
</html>

View File

@@ -1,63 +0,0 @@
<?php
/**
* Example for a proxy that rebroadcasts all PGTs to different servers in the
* cluster
*
* PHP Version 5
*
* @file example_proxy_rebroadcast.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// Set the nodes for rebroadcasting pgtIou/pgtId and logoutRequest
phpCAS::addRebroadcastNode($rebroadcast_node_1);
phpCAS::addRebroadcastNode($rebroadcast_node_2);
// handle incoming logout requests
phpCAS::handleLogoutRequests();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
?>
<html>
<head>
<title>phpCAS proxy rebroadcast example</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>phpCAS proxy rebroadcast example</h1>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
</body>
</html>

View File

@@ -1,71 +0,0 @@
<?php
/**
* Example for a proxy with session usage
*
* PHP Version 5
*
* @file example_proxy_GET.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
?>
<html>
<head>
<title>phpCAS proxied proxy example (with sessioning)</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>phpCAS proxied proxy example (with sessioning)</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<h2>Response from service <?php echo $serviceUrl; ?></h2>
<?php
flush();
// call a service and change the color depending on the result
if (phpCAS::serviceWeb($serviceUrl, $err_code, $output)) {
echo '<div class="success">';
} else {
echo '<div class="error">';
}
echo $output;
echo '</div>';
?>
</body>
</html>

View File

@@ -1,71 +0,0 @@
<?php
/**
* Example for a proxy with session usage
*
* PHP Version 5
*
* @file example_proxy_serviceWeb_chaining.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
?>
<html>
<head>
<title>phpCAS proxy example #2</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>phpCAS proxied proxy example</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<h2>Response from service <?php echo $serviceUrl2; ?></h2>
<?php
flush();
// call a service and change the color depending on the result
if (phpCAS::serviceWeb($serviceUrl2, $err_code, $output)) {
echo '<div class="success">';
} else {
echo '<div class="error">';
}
echo $output;
echo '</div>';
?>
</body>
</html>

View File

@@ -1,72 +0,0 @@
<?php
/**
* Example for a simple cas 2.0 client
*
* PHP Version 5
*
* @file example_renew.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::renewAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
// logout if desired
if (isset($_REQUEST['session'])) {
session_unset();
session_destroy();
unset($_REQUEST['session']);
header("Location: ".$_SERVER['PHP_SELF']);
}
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
<p><a href="?logout=">Logout</a></p>
<p><a href="?session=">Kill local Session</a></p>
</body>
</html>

View File

@@ -1,96 +0,0 @@
<?php
/**
* Example for proxied service with session support
*
* PHP Version 5
*
* @file example_service.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// If you want your service to be proxied you have to enable it (default
// disabled) and define an accepable list of proxies that are allowed to
// proxy your service.
//
// Add each allowed proxy definition object. For the normal CAS_ProxyChain
// class, the constructor takes an array of proxies to match. The list is in
// reverse just as seen from the service. Proxies have to be defined in reverse
// from the service to the user. If a user hits service A and gets proxied via
// B to service C the list of acceptable on C would be array(B,A). The definition
// of an individual proxy can be either a string or a regexp (preg_match is used)
// that will be matched against the proxy list supplied by the cas server
// when validating the proxy tickets. The strings are compared starting from
// the beginning and must fully match with the proxies in the list.
// Example:
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
// 'https://app.example.com/'
// )));
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
// '/^https:\/\/app[0-9]\.example\.com\/rest\//',
// 'http://client.example.com/'
// )));
phpCAS::allowProxyChain(new CAS_ProxyChain(array($pgtUrlRegexp)));
phpCAS::allowProxyChain(
new CAS_ProxyChain(
array('/^' . $pgtBase . 'example_service_that_proxies.php$/',
'/^' . $pgtBase . 'example_proxy_serviceWeb_chaining.php$/'
)
)
);
// For quick testing or in certain production screnarios you might want to
// allow allow any other valid service to proxy your service. To do so, add
// the "Any" chain:
// phpcas::allowProxyChain(new CAS_ProxyChain_Any);
// THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
// IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
// ON THIS SERVICE.
//phpcas::allowProxyChain(new CAS_ProxyChain_Any);
// force CAS authentication
phpCAS::forceAuthentication();
print '<h1>I am a service that can be proxied.</h1>';
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
require 'script_info.php';
// for this test, simply print that the authentication was successfull
echo '<p>The user\'s login is <b>' . phpCAS::getUser() . '</b>.</p>';
// increment the number of requests of the session and print it
if (!isset($_SESSION['n'])) {
$_SESSION['n'] = 0;
}
echo '<p>request #' . (++$_SESSION['n']) . '</p>';
?>

View File

@@ -1,105 +0,0 @@
<?php
/**
* Example for proxied service with session support and POST support
*
* PHP Version 5
*
* @file example_service_POST.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// If you want your service to be proxied you have to enable it (default
// disabled) and define an accepable list of proxies that are allowed to
// proxy your service.
//
// Add each allowed proxy definition object. For the normal CAS_ProxyChain
// class, the constructor takes an array of proxies to match. The list is in
// reverse just as seen from the service. Proxies have to be defined in reverse
// from the service to the user. If a user hits service A and gets proxied via
// B to service C the list of acceptable on C would be array(B,A). The definition
// of an individual proxy can be either a string or a regexp (preg_match is used)
// that will be matched against the proxy list supplied by the cas server
// when validating the proxy tickets. The strings are compared starting from
// the beginning and must fully match with the proxies in the list.
// Example:
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
// 'https://app.example.com/'
// )));
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
// '/^https:\/\/app[0-9]\.example\.com\/rest\//',
// 'http://client.example.com/'
// )));
phpCAS::allowProxyChain(new CAS_ProxyChain(array($pgtUrlRegexp)));
// For quick testing or in certain production screnarios you might want to
// allow allow any other valid service to proxy your service. To do so, add
// the "Any" chain:
// phpcas::allowProxyChain(new CAS_ProxyChain_Any);
// THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
// IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
// ON THIS SERVICE.
//phpcas::allowProxyChain(new CAS_ProxyChain_Any);
// force CAS authentication
phpCAS::forceAuthentication();
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
header('HTTP/1.1 400 Bad Request');
print
"<h1>I only respond to POST requests. This is a "
. $_SERVER['REQUEST_METHOD'] . " request.</h1>";
exit;
}
if (empty($_POST['favorite_color'])) {
header('HTTP/1.1 400 Bad Request');
print '<h1>You must post a <strong>favorite_color</strong>.</h1>';
exit;
}
print '<h1>I am a service that responds to POST requests.</h1>';
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
require 'script_info.php';
// for this test, simply print that the authentication was successfull
echo '<p>The user\'s login is <b>' . phpCAS::getUser() . '</b>.</p>';
print
'<h1>Your favorite color is ' . htmlentities($_POST['favorite_color'])
. '</h1>';
// increment the number of requests of the session and print it
if (!isset($_SESSION['n'])) {
$_SESSION['n'] = 0;
}
echo '<p>request #' . (++$_SESSION['n']) . '</p>';

View File

@@ -1,106 +0,0 @@
<?php
/**
* Example for a proxied proxy
*
* PHP Version 5
*
* @file example_service_that_proxies.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::proxy(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// If you want your service to be proxied you have to enable it (default
// disabled) and define an accepable list of proxies that are allowed to
// proxy your service.
//
// Add each allowed proxy definition object. For the normal CAS_ProxyChain
// class, the constructor takes an array of proxies to match. The list is in
// reverse just as seen from the service. Proxies have to be defined in reverse
// from the service to the user. If a user hits service A and gets proxied via
// B to service C the list of acceptable on C would be array(B,A). The definition
// of an individual proxy can be either a string or a regexp (preg_match is used)
// that will be matched against the proxy list supplied by the cas server
// when validating the proxy tickets. The strings are compared starting from
// the beginning and must fully match with the proxies in the list.
// Example:
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
// 'https://app.example.com/'
// )));
// phpCAS::allowProxyChain(new CAS_ProxyChain(array(
// '/^https:\/\/app[0-9]\.example\.com\/rest\//',
// 'http://client.example.com/'
// )));
phpCAS::allowProxyChain(new CAS_ProxyChain(array($pgtUrlRegexp)));
// For quick testing or in certain production screnarios you might want to
// allow allow any other valid service to proxy your service. To do so, add
// the "Any" chain:
// phpcas::allowProxyChain(new CAS_ProxyChain_Any);
// THIS SETTING IS HOWEVER NOT RECOMMENDED FOR PRODUCTION AND HAS SECURITY
// IMPLICATIONS: YOU ARE ALLOWING ANY SERVICE TO ACT ON BEHALF OF A USER
// ON THIS SERVICE.
//phpcas::allowProxyChain(new CAS_ProxyChain_Any);
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// moreover, a PGT was retrieved from the CAS server that will
// permit to gain accesses to new services.
?>
<html>
<head>
<title>phpCAS proxied proxy service example</title>
<link rel="stylesheet" type='text/css' href='example.css'/>
</head>
<body>
<h1>I am a service that can be proxied. In turn, I proxy another service.</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<h2>Response from service <?php echo $serviceUrl; ?></h2>
<?php
flush();
// call a service and change the color depending on the result
if ( phpCAS::serviceWeb($serviceUrl, $err_code, $output) ) {
echo '<div class="success">';
} else {
echo '<div class="error">';
}
echo $output;
echo '</div>';
?>
</body>
</html>

View File

@@ -1,63 +0,0 @@
<?php
/**
* Example for a simple cas 2.0 client
*
* PHP Version 5
*
* @file example_simple.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/
// Load the settings from the central config file
require_once 'config.php';
// Load the CAS lib
require_once $phpcas_path . '/CAS.php';
// Enable debugging
phpCAS::setDebug();
// Enable verbose error messages. Disable in production!
phpCAS::setVerbose(true);
// Initialize phpCAS
phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
// For production use set the CA certificate that is the issuer of the cert
// on the CAS server and uncomment the line below
// phpCAS::setCasServerCACert($cas_server_ca_cert_path);
// For quick testing you can disable SSL validation of the CAS server.
// THIS SETTING IS NOT RECOMMENDED FOR PRODUCTION.
// VALIDATING THE CAS SERVER IS CRUCIAL TO THE SECURITY OF THE CAS PROTOCOL!
phpCAS::setNoCasServerValidation();
// force CAS authentication
phpCAS::forceAuthentication();
// at this step, the user has been authenticated by the CAS server
// and the user's login name can be read with phpCAS::getUser().
// logout if desired
if (isset($_REQUEST['logout'])) {
phpCAS::logout();
}
// for this test, simply print that the authentication was successfull
?>
<html>
<head>
<title>phpCAS simple client</title>
</head>
<body>
<h1>Successfull Authentication!</h1>
<?php require 'script_info.php' ?>
<p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>
<p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>
<p><a href="?logout=">Logout</a></p>
</body>
</html>

View File

@@ -1,20 +0,0 @@
<?php
/**
* Small script to add some info about the example script that is running.
* Adds some info that makes it easier to distinguish different proxy sessions
*
* PHP Version 5
*
* @file script_info.php
* @category Authentication
* @package PhpCAS
* @author Joachim Fritschi <jfritschi@freenet.de>
* @author Adam Franco <afranco@middlebury.edu>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://wiki.jasig.org/display/CASC/phpCAS
*/ ?>
<dl style='border: 1px dotted; padding: 5px;'>
<dt>Current script</dt><dd><?php print basename($_SERVER['SCRIPT_NAME']); ?></dd>
<dt>session_name():</dt><dd> <?php print session_name(); ?></dd>
<dt>session_id():</dt><dd> <?php print session_id(); ?></dd>
</dl>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>phpCAS</title>
</head>
<body>
<p><img src="images/phpcas.png" width="191" height="68"/></p>
<p>phpCAS documentation is hosted at <a href="https://wiki.jasig.org/display/CASC/phpCAS">https://wiki.jasig.org/display/CASC/phpCAS</a>.</p>
<ul>
<li><a href="examples">examples</a></li>
<li><a href="http://downloads.jasig.org/cas-clients/php/1.3.4/docs/api/">source documentation</a></li>
</ul>
<p><img src="images/esup-portail.png" width="182" height="68"/> <img src="images/jasig.png" width="169" height="87"/></p>
<p>&nbsp;</p>
</body>
</html>

View File

@@ -1,80 +0,0 @@
# $Id: Makefile,v 1.13 2008/03/07 13:01:55 ggiunta Exp $
### USER EDITABLE VARS ###
WEB=/var/www/xmlrpc/doc
MKDIR=mkdir
PHP=php
FOP=fop
PHPDOC=phpdoc
#### DO NOT TOUCH FROM HERE ONWARDS ###
install:
${MKDIR} -p ${WEB}
cp *.html ${WEB}
cp *.css ${WEB}
cp *.gif ${WEB}
@echo HTML version of the manual has been installed to ${WEB}
### the following targets are to be used for library development ###
doc: out/index.html xmlrpc_php.pdf javadoc-out/index.html
# tools currently used in building docs: php 5 with xsl extension, apache fop, phpdocumentor
# alternatives include doxygen, jade, saxon, xsltproc etc...
out/index.html xmlrpc_php.pdf: xmlrpc_php.xml
-${MKDIR} out
# Jade cmd yet to be rebuilt, starting from xml file and putting output in ./out dir, e.g.
# jade -t xml -d custom.dsl xmlrpc_php.xml
#
# convertdoc command for xmlmind xxe editor
# convertdoc docb.toHTML xmlrpc_php.xml -u out
#
# saxon + xerces xml parser + saxon extensions + xslthl: adds a little syntax highligting
# (bold and italics only, no color) for php source examples...
# java \
# -classpath c:\programmi\saxon\saxon.jar\;c:\programmi\saxon\xslthl.jar\;c:\programmi\xerces\xercesImpl.jar\;C:\htdocs\xmlrpc_cvs\docbook-xsl\extensions\saxon65.jar \
# -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl \
# -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl \
# -Dxslthl.config=file:///c:/htdocs/xmlrpc_cvs/docbook-xsl/highlighting/xslthl-config.xml \
# com.icl.saxon.StyleSheet -o xmlrpc_php.fo.xml xmlrpc_php.xml custom.fo.xsl use.extensions=1
#
# custom php script that does the xslt magic
${PHP} convert.php xmlrpc_php.xml custom.xsl out/
# post process html files to highlight php code samples
${PHP} highlight.php out
# convert to fo and then to pdf using apache fop
${PHP} convert.php xmlrpc_php.xml custom.fo.xsl xmlrpc_php.fo.xml
${FOP} xmlrpc_php.fo.xml xmlrpc_php.pdf
# -rm xmlrpc_php.fo.xml
javadoc-out/index.html: ../lib/xmlrpc.inc ../lib/xmlrpcs.inc ../lib/xmlrpc_wrappers.inc
# generate docs out of javadoc via doxygen
# doxygen phpxmlrpc.dox
#
# generate docs out of javadoc via phpdocumentor
${PHPDOC} -f ../lib/xmlrpc.inc,../lib/xmlrpcs.inc,../lib/xmlrpc_wrappers.inc -t javadoc-out -ti PHP-XMLRPC -o HTML:frames:default -s
dist: doc
${MKDIR} -p ../xmlrpc-${VERSION}/doc
-cp out/*.html ../xmlrpc-${VERSION}/doc
-cp out/*.css ../xmlrpc-${VERSION}/doc
-cp out/*.gif ../xmlrpc-${VERSION}/doc
-cp out/*.pdf ../xmlrpc-${VERSION}/doc
cp xmlrpc_php.xml ../xmlrpc-${VERSION}/doc
cp xmlrpc_php.pdf ../xmlrpc-${VERSION}/doc
cp Makefile ../xmlrpc-${VERSION}/doc
clean:
-rm -f out/*.html
-rm -rf javadoc-out
-rm xmlrpc_php.fo.xml
-rm xmlrpc_php.pdf

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix A. Integration with the PHP xmlrpc extension</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch12s08.html" title="Does the library support using cookies / http sessions?" /><link rel="next" href="apb.html" title="Appendix B. Substitution of the PHP xmlrpc extension" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix A. Integration with the PHP xmlrpc extension</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s08.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="apb.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="integration"></a>Appendix A. Integration with the PHP xmlrpc extension</h2></div></div></div><p>To be documented more...</p><p>In short: for the fastest execution possible, you can enable the php
native xmlrpc extension, and use it in conjunction with phpxmlrpc. The
following code snippet gives an example of such integration</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">/***&nbsp;client&nbsp;side&nbsp;***/<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://phpxmlrpc.sourceforge.net/server.php'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;tell&nbsp;the&nbsp;client&nbsp;to&nbsp;return&nbsp;raw&nbsp;xml&nbsp;as&nbsp;response&nbsp;value<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">return_type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'xml'</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;let&nbsp;the&nbsp;native&nbsp;xmlrpc&nbsp;extension&nbsp;take&nbsp;care&nbsp;of&nbsp;encoding&nbsp;request&nbsp;parameters<br /></span><span style="color: #0000BB">$r&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">xmlrpc_encode_request</span><span style="color: #007700">(</span><span style="color: #DD0000">'examples.getStateName'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'stateno'</span><span style="color: #007700">]));<br /><br />if&nbsp;(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;HTTP&nbsp;transport&nbsp;error<br />&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'Got&nbsp;error&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">();<br />else<br />{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;HTTP&nbsp;request&nbsp;OK,&nbsp;but&nbsp;XML&nbsp;returned&nbsp;from&nbsp;server&nbsp;not&nbsp;parsed&nbsp;yet<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xmlrpc_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">());<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;we&nbsp;got&nbsp;a&nbsp;valid&nbsp;xmlrpc&nbsp;response&nbsp;from&nbsp;server<br />&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Got&nbsp;invalid&nbsp;response'</span><span style="color: #007700">;<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;check&nbsp;if&nbsp;server&nbsp;sent&nbsp;a&nbsp;fault&nbsp;response<br />&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">xmlrpc_is_fault</span><span style="color: #007700">(</span><span style="color: #0000BB">$v</span><span style="color: #007700">))<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Got&nbsp;xmlrpc&nbsp;fault&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$v</span><span style="color: #007700">[</span><span style="color: #DD0000">'faultCode'</span><span style="color: #007700">];<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;echo</span><span style="color: #DD0000">'Got&nbsp;response:&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$v</span><span style="color: #007700">);<br />}</span>
</span>
</code></pre></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s08.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="apb.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Does the library support using cookies / http sessions? </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix B. Substitution of the PHP xmlrpc extension</td></tr></table></div></body></html>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix B. Substitution of the PHP xmlrpc extension</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="apa.html" title="Appendix A. Integration with the PHP xmlrpc extension" /><link rel="next" href="apc.html" title="Appendix C. 'Enough of xmlrpcvals!': new style library usage" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix B. Substitution of the PHP xmlrpc extension</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apa.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="apc.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="substitution"></a>Appendix B. Substitution of the PHP xmlrpc extension</h2></div></div></div><p>Yet another interesting situation is when you are using a ready-made
php application, that provides support for the XMLRPC protocol via the
native php xmlrpc extension, but the extension is not available on your
php install (e.g. because of shared hosting constraints).</p><p>Since version 2.1, the PHP-XMLRPC library provides a compatibility
layer that aims to be 100% compliant with the xmlrpc extension API. This
means that any code written to run on the extension should obtain the
exact same results, albeit using more resources and a longer processing
time, using the PHP-XMLRPC library and the extension compatibility module.
The module is part of the EXTRAS package, available as a separate download
from the sourceforge.net website, since version 0.2</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apa.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="apc.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix A. Integration with the PHP xmlrpc extension </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix C. 'Enough of xmlrpcvals!': new style library usage</td></tr></table></div></body></html>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix C. 'Enough of xmlrpcvals!': new style library usage</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="apb.html" title="Appendix B. Substitution of the PHP xmlrpc extension" /><link rel="next" href="apd.html" title="Appendix D. Usage of the debugger" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix C. 'Enough of xmlrpcvals!': new style library usage</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apb.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="apd.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="enough"></a>Appendix C. 'Enough of xmlrpcvals!': new style library usage</h2></div></div></div><p>To be documented...</p><p>In the meantime, see docs about xmlrpc_client::return_type and
xmlrpc_server::functions_parameters_types, as well as php_xmlrpc_encode,
php_xmlrpc_decode and php_xmlrpc_decode_xml</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apb.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="apd.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Appendix B. Substitution of the PHP xmlrpc extension </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix D. Usage of the debugger</td></tr></table></div></body></html>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Appendix D. Usage of the debugger</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="apc.html" title="Appendix C. 'Enough of xmlrpcvals!': new style library usage" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Appendix D. Usage of the debugger</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="apc.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> </td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="debugger"></a>Appendix D. Usage of the debugger</h2></div></div></div><p>A webservice debugger is included in the library to help during
development and testing.</p><p>The interface should be self-explicative enough to need little
documentation.</p><div align="center"><img src="debugger.gif" align="middle" /></div><p>The most useful feature of the debugger is without doubt the "Show
debug info" option. It allows to have a screen dump of the complete http
communication between client and server, including the http headers as
well as the request and response payloads, and is invaluable when
troubleshooting problems with charset encoding, authentication or http
compression.</p><p>The debugger can take advantage of the JSONRPC library extension, to
allow debugging of JSON-RPC webservices, and of the JS-XMLRPC library
visual editor to allow easy mouse-driven construction of the payload for
remote methods. Both components have to be downloaded separately from the
sourceforge.net web pages and copied to the debugger directory to enable
the extra functionality:</p><div class="itemizedlist"><ul type="disc"><li><p>to enable jsonrpc functionality, download the PHP-XMLRPC
EXTRAS package, and copy the file <code class="filename">jsonrpc.inc</code>
either to the same directory as the debugger or somewhere in your
php include path</p></li></ul></div><div class="itemizedlist"><ul type="disc"><li><p>to enable the visual value editing dialog, download the
JS-XMLRPC library, and copy somewhere in the web root files
<code class="filename">visualeditor.php</code>,
<code class="filename">visualeditor.css</code> and the folders
<code class="filename">yui</code> and <code class="filename">img</code>. Then edit the
debugger file <code class="filename">controller.php</code> and set
appropriately the variable <code class="varname">$editorpath</code>.</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="apc.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top">Appendix C. 'Enough of xmlrpcvals!': new style library usage </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 1. Introduction</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="index.html" title="XML-RPC for PHP" /><link rel="next" href="ch02.html" title="Chapter 2. What's new" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 1. Introduction</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="introduction"></a>Chapter 1. Introduction</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch01.html#id930303">Acknowledgements</a></span></dt></dl></div><p>XML-RPC is a format devised by <a class="ulink" href="http://www.userland.com/" target="_top">Userland Software</a> for achieving
remote procedure call via XML using HTTP as the transport. XML-RPC has its
own web site, <a class="ulink" href="http://www.xmlrpc.com/" target="_top">www.xmlrpc.com</a></p><p>This collection of PHP classes provides a framework for writing
XML-RPC clients and servers in PHP.</p><p>Main goals of the project are ease of use, flexibility and
completeness.</p><p>The original author is Edd Dumbill of <a class="ulink" href="http://usefulinc.com/" target="_top">Useful Information Company</a>. As of the
1.0 stable release, the project was opened to wider involvement and moved
to <a class="ulink" href="http://phpxmlrpc.sourceforge.net/" target="_top">SourceForge</a>.</p><p>A list of XML-RPC implementations for other languages such as Perl
and Python can be found on the <a class="ulink" href="http://www.xmlrpc.com/" target="_top">www.xmlrpc.com</a> site.</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id930303"></a>Acknowledgements</h2></div></div></div><p>Daniel E. Baumann</p><p>James Bercegay</p><p>Leon Blackwell</p><p>Stephane Bortzmeyer</p><p>Daniel Convissor</p><p>Geoffrey T. Dairiki</p><p>Stefan Esser</p><p>James Flemer</p><p>Ernst de Haan</p><p>Tom Knight</p><p>Axel Kollmorgen</p><p>Peter Kocks</p><p>Daniel Krippner</p><p>S. Kuip</p><p>A. Lambert</p><p>Frederic Lecointre</p><p>Dan Libby</p><p>Arnaud Limbourg</p><p>Ernest MacDougal Campbell III</p><p>Lukasz Mach</p><p>Kjartan Mannes</p><p>Ben Margolin</p><p>Nicolay Mausz</p><p>Justin Miller</p><p>Jan Pfeifer</p><p>Giancarlo Pinerolo</p><p>Peter Russel</p><p>Jean-Jacques Sarton</p><p>Viliam Simko</p><p>Idan Sofer</p><p>Douglas Squirrel</p><p>Heiko Stübner</p><p>Anatoly Techtonik</p><p>Tommaso Trani</p><p>Eric van der Vlist</p><p>Christian Wenz</p><p>Jim Winstead</p><p>Przemyslaw Wroblewski</p><p>Bruno Zanetti Melotti</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="index.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">XML-RPC for PHP </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 2. What's new</td></tr></table></div></body></html>

View File

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 2. What's new</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch01.html" title="Chapter 1. Introduction" /><link rel="next" href="ch02s02.html" title="2.2.2" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. What's new</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch01.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch02s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="news"></a>Chapter 2. What's new</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch02.html#id930465">3.0.0 beta</a></span></dt><dt><span class="sect1"><a href="ch02s02.html">2.2.2</a></span></dt><dt><span class="sect1"><a href="ch02s03.html">2.2.1</a></span></dt><dt><span class="sect1"><a href="ch02s04.html">2.2</a></span></dt><dt><span class="sect1"><a href="ch02s05.html">2.1</a></span></dt><dt><span class="sect1"><a href="ch02s06.html">2.0 final</a></span></dt><dt><span class="sect1"><a href="ch02s07.html">2.0 Release candidate 3</a></span></dt><dt><span class="sect1"><a href="ch02s08.html">2.0 Release candidate 2</a></span></dt><dt><span class="sect1"><a href="ch02s09.html">2.0 Release candidate 1</a></span></dt></dl></div><p><span class="emphasis"><em>Note:</em></span> not all items the following list have
(yet) been fully documented, and some might not be present in any other
chapter in the manual. To find a more detailed description of new
functions and methods please take a look at the source code of the
library, which is quite thoroughly commented in javadoc-like form.</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id930465"></a>3.0.0 beta</h2></div></div></div><p>This is the first release of the library to only support PHP 5.
Some legacy code has been removed, and support for features such as
exceptions and dateTime objects introduced.</p><p>The "beta" tag is meant to indicate the fact that the refactoring
has been more widespread than in precedent releases and that more
changes are likely to be introduced with time - the library is still
considered to be production quality.</p><div class="itemizedlist"><ul type="disc"><li><p>improved: removed all usage of php functions deprecated in
php 5.3, usage of assign-by-ref when creating new objects
etc...</p></li><li><p>improved: add support for the &lt;ex:nil/&gt; tag used by
the apache library, both in input and output</p></li><li><p>improved: add support for <code class="classname">dateTime</code>
objects in both in <code class="function">php_xmlrpc_encode</code> and as
parameter for constructor of
<code class="classname">xmlrpcval</code></p></li><li><p>improved: add support for timestamps as parameter for
constructor of <code class="classname">xmlrpcval</code></p></li><li><p>improved: add option 'dates_as_objects' to
<code class="function">php_xmlrpc_decode</code> to return
<code class="classname">dateTime</code> objects for xmlrpc
datetimes</p></li><li><p>improved: add new method
<code class="methodname">SetCurlOptions</code> to
<code class="classname">xmrlpc_client</code> to allow extra flexibility in
tweaking http config, such as explicitly binding to an ip
address</p></li><li><p>improved: add new method
<code class="methodname">SetUserAgent</code> to
<code class="classname">xmrlpc_client</code> to to allow having different
user-agent http headers</p></li><li><p>improved: add a new member variable in server class to allow
fine-tuning of the encoding of returned values when the server is
in 'phpvals' mode</p></li><li><p>improved: allow servers in 'xmlrpcvals' mode to also
register plain php functions by defining them in the dispatch map
with an added option</p></li><li><p>improved: catch exceptions thrown during execution of php
functions exposed as methods by the server</p></li><li><p>fixed: bad encoding if same object is encoded twice using
php_xmlrpc_encode</p></li></ul></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch01.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch02s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 1. Introduction </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.2.2</td></tr></table></div></body></html>

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.2.2</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02.html" title="Chapter 2. What's new" /><link rel="next" href="ch02s03.html" title="2.2.1" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.2.2</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id930754"></a>2.2.2</h2></div></div></div><p><span class="emphasis"><em>Note:</em></span> this might the last release of the
library that will support PHP 4. Future releases (if any) should target
php 5.0 as minimum supported version.</p><div class="itemizedlist"><ul type="disc"><li><p>fixed: encoding of utf-8 characters outside of the BMP
plane</p></li><li><p>fixed: character set declarations surrounded by double
quotes were not recognized in http headers</p></li><li><p>fixed: be more tolerant in detection of charset in http
headers</p></li><li><p>fixed: fix detection of zlib.output_compression</p></li><li><p>fixed: use feof() to test if socket connections are to be
closed instead of the number of bytes read (rare bug when
communicating with some servers)</p></li><li><p>fixed: format floating point values using the correct
decimal separator even when php locale is set to one that uses
comma</p></li><li><p>fixed: improve robustness of the debugger when parsing weird
results from non-compliant servers</p></li><li><p>php warning when receiving 'false' in a bool value</p></li><li><p>improved: allow the add_to_map server method to add docs for
single params too</p></li><li><p>improved: added the possibility to wrap for exposure as
xmlrpc methods plain php class methods, object methods and even
whole classes</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. What's new </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.2.1</td></tr></table></div></body></html>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.2.1</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02s02.html" title="2.2.2" /><link rel="next" href="ch02s04.html" title="2.2" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.2.1</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id930844"></a>2.2.1</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>fixed: work aroung bug in php 5.2.2 which broke support of
HTTP_RAW_POST_DATA</p></li><li><p>fixed: is_dir parameter of setCaCertificate() method is
reversed</p></li><li><p>fixed: a php warning in xmlrpc_client creator method</p></li><li><p>fixed: parsing of '1e+1' as valid float</p></li><li><p>fixed: allow errorlevel 3 to work when prev. error handler was
a static method</p></li><li><p>fixed: usage of client::setcookie() for multiple cookies in
non-ssl mode</p></li><li><p>improved: support for CP1252 charset is not part or the
library but almost possible</p></li><li><p>improved: more info when curl is enabled and debug mode is
on</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.2.2 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.2</td></tr></table></div></body></html>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.2</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02s03.html" title="2.2.1" /><link rel="next" href="ch02s05.html" title="2.1" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.2</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch02s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id930912"></a>2.2</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>fixed: debugger errors on php installs with magic_quotes_gpc
on</p></li><li><p>fixed: support for https connections via proxy</p></li><li><p>fixed: wrap_xmlrpc_method() generated code failed to properly
encode php objects</p></li><li><p>improved: slightly faster encoding of data which is internally
UTF-8</p></li><li><p>improved: debugger always generates a 'null' id for jsonrpc if
user omits it</p></li><li><p>new: debugger can take advantage of a graphical value builder
(it has to be downloaded separately, as part of jsxmlrpc package.
See Appendix D for more details)</p></li><li><p>new: support for the &lt;NIL/&gt; xmlrpc extension. see below
for more details</p></li><li><p>new: server support for the system.getCapabilities xmlrpc
extension</p></li><li><p>new: <code class="function"><a class="link" href="ch09.html#wrap_xmlrpc_method">wrap_xmlrpc_method()</a></code>
accepts two new options: debug and return_on_fault</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.2.1 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.1</td></tr></table></div></body></html>

View File

@@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.1</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02s04.html" title="2.2" /><link rel="next" href="ch02s06.html" title="2.0 final" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.1</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s04.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch02s06.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id931019"></a>2.1</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>The <code class="function">wrap_php_function</code> and
<code class="function">wrap_xmlrpc_method</code> functions have been moved
out of the base library file <code class="filename">xmlrpc.inc</code> into
a file of their own: <code class="filename">xmlrpc_wrappers.inc</code>. You
will have to include() / require() it in your scripts if you have
been using those functions. For increased security, the automatic
rebuilding of php object instances out of received xmlrpc structs
in <code class="function">wrap_xmlrpc_method()</code> has been disabled
(but it can be optionally re-enabled). Both
<code class="function">wrap_php_function()</code> and
<code class="function">wrap_xmlrpc_method()</code> functions accept many
more options to fine tune their behaviour, including one to return
the php code to be saved and later used as standalone php
script</p></li><li><p>The constructor of xmlrpcval() values has seen some internal
changes, and it will not throw a php warning anymore when invoked
using an unknown xmlrpc type: the error will only be written to
php error log. Also <code class="code">new xmlrpcval('true', 'boolean')</code>
is not supported anymore</p></li><li><p>The new function
<code class="function">php_xmlrpc_decode_xml()</code> will take the xml
representation of either an xmlrpc request, response or single
value and return the corresponding php-xmlrpc object
instance</p></li><li><p>A new function <code class="function">wrap_xmlrpc_server()</code>has
been added, to wrap all (or some) of the methods exposed by a
remote xmlrpc server into a php class</p></li><li><p>A new file has been added:
<code class="filename">verify_compat.php</code>, to help users diagnose the
level of compliance of their php installation with the
library</p></li><li><p>Restored compatibility with php 4.0.5 (for those poor souls
still stuck on it)</p></li><li><p>Method <code class="methodname">xmlrpc_server-&gt;service()</code>
now returns a value: either the response payload or xmlrpcresp
object instance</p></li><li><p>Method
<code class="methodname">xmlrpc_server-&gt;add_to_map()</code> now
accepts xmlrpc methods with no param definitions</p></li><li><p>Documentation for single parameters of exposed methods can
be added to the dispatch map (and turned into html docs in
conjunction with a future release of the 'extras' package)</p></li><li><p>Full response payload is saved into xmlrpcresp object for
further debugging</p></li><li><p>The debugger can now generate code that wraps a remote
method into a php function (works for jsonrpc, too); it also has
better support for being activated via a single GET call (e.g. for
integration into other tools)</p></li><li><p>Stricter parsing of incoming xmlrpc messages: two more
invalid cases are now detected (double <code class="literal">data</code>
element inside <code class="literal">array</code> and
<code class="literal">struct</code>/<code class="literal">array</code> after scalar
inside <code class="literal">value</code> element)</p></li><li><p>More logging of errors in a lot of situations</p></li><li><p>Javadoc documentation of lib files (almost) complete</p></li><li><p>Many performance tweaks and code cleanups, plus the usual
crop of bugs fixed (see NEWS file for complete list of
bugs)</p></li><li><p>Lib internals have been modified to provide better support
for grafting extra functionality on top of it. Stay tuned for
future releases of the EXTRAS package (or go read Appendix
B)...</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.2 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.0 final</td></tr></table></div></body></html>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 final</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02s05.html" title="2.1" /><link rel="next" href="ch02s07.html" title="2.0 Release candidate 3" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.0 final</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s05.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch02s07.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id931211"></a>2.0 final</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>Added to the client class the possibility to use Digest and
NTLM authentication methods (when using the CURL library) for
connecting to servers and NTLM for connecting to proxies</p></li><li><p>Added to the client class the possibility to specify
alternate certificate files/directories for authenticating the
peer with when using HTTPS communication</p></li><li><p>Reviewed all examples and added a new demo file, containing
a proxy to forward xmlrpc requests to other servers (useful e.g.
for ajax coding)</p></li><li><p>The debugger has been upgraded to reflect the new client
capabilities</p></li><li><p>All known bugs have been squashed, and the lib is more
tolerant than ever of commonly-found mistakes</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.1 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.0 Release candidate 3</td></tr></table></div></body></html>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 Release candidate 3</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02s06.html" title="2.0 final" /><link rel="next" href="ch02s08.html" title="2.0 Release candidate 2" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.0 Release candidate 3</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s06.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch02s08.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id931316"></a>2.0 Release candidate 3</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>Added to server class the property
<span class="property">functions_parameters_type</span>, that allows the
server to register plain php functions as xmlrpc methods (i.e.
functions that do not take an xmlrpcmsg object as unique
param)</p></li><li><p>let server and client objects serialize calls using a
specified character set encoding for the produced xml instead of
US-ASCII (ISO-8859-1 and UTF-8 supported)</p></li><li><p>let php_xmlrpc_decode accept xmlrpcmsg objects as valid
input</p></li><li><p>'class::method' syntax is now accepted in the server
dispatch map</p></li><li><p><code class="function">xmlrpc_clent::SetDebug()</code> accepts
integer values instead of a boolean value, with debugging level 2
adding to the information printed to screen the complete client
request</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.0 final </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.0 Release candidate 2</td></tr></table></div></body></html>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 Release candidate 2</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02s07.html" title="2.0 Release candidate 3" /><link rel="next" href="ch02s09.html" title="2.0 Release candidate 1" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.0 Release candidate 2</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch02s09.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id931370"></a>2.0 Release candidate 2</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>Added a new property of the client object:
<code class="code">xmlrpc_client-&gt;return_type</code>, indicating whether
calls to the send() method will return xmlrpcresp objects whose
value() is an xmlrpcval object, a php value (automatically
decoded) or the raw xml received from the server.</p></li><li><p>Added in the extras dir. two new library file:
<code class="filename">jsonrpc.inc</code> and
<code class="filename">jsonrpcs.inc</code> containing new classes that
implement support for the json-rpc protocol (alpha quality
code)</p></li><li><p>Added a new client method: <code class="code">setKey($key,
$keypass)</code> to be used in HTTPS connections</p></li><li><p>Added a new file containing some benchmarks in the testsuite
directory</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.0 Release candidate 3 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2.0 Release candidate 1</td></tr></table></div></body></html>

View File

@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>2.0 Release candidate 1</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch02.html" title="Chapter 2. What's new" /><link rel="prev" href="ch02s08.html" title="2.0 Release candidate 2" /><link rel="next" href="ch03.html" title="Chapter 3. System Requirements" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.0 Release candidate 1</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><th width="60%" align="center">Chapter 2. What's new</th><td width="20%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id931426"></a>2.0 Release candidate 1</h2></div></div></div><div class="itemizedlist"><ul type="disc"><li><p>Support for HTTP proxies (new method:
<code class="code">xmlrpc_client::setProxy()</code>)</p></li><li><p>Support HTTP compression of both requests and responses.
Clients can specify what kind of compression they accept for
responses between deflate/gzip/any, and whether to compress the
requests. Servers by default compress responses to clients that
explicitly declare support for compression (new methods:
<code class="code">xmlrpc_client::setAcceptedCompression()</code>,
<code class="code">xmlrpc_client::setRequestCompression()</code>). Note that the
ZLIB php extension needs to be enabled in PHP to support
compression.</p></li><li><p>Implement HTTP 1.1 connections, but only if CURL is enabled
(added an extra parameter to
<code class="code">xmlrpc_client::xmlrpc_client</code> to set the desired HTTP
protocol at creation time and a new supported value for the last
parameter of <code class="code">xmlrpc_client::send</code>, which now can be
safely omitted if it has been specified at creation time)</p><p>With PHP versions greater than 4.3.8 keep-alives are enabled
by default for HTTP 1.1 connections. This should yield faster
execution times when making multiple calls in sequence to the same
xml-rpc server from a single client.</p></li><li><p>Introduce support for cookies. Cookies to be sent to the
server with a request can be set using
<code class="code">xmlrpc_client::setCookie()</code>, while cookies received from
the server are found in <code class="code">xmlrpcresp::cookies()</code>. It is
left to the user to check for validity of received cookies and
decide whether they apply to successive calls or not.</p></li><li><p>Better support for detecting different character set encodings
of xml-rpc requests and responses: both client and server objects
will correctly detect the charset encoding of received xml, and use
an appropriate xml parser.</p><p>Supported encodings are US-ASCII, UTF-8 and ISO-8859-1.</p></li><li><p>Added one new xmlrpcmsg constructor syntax, allowing usage of
a single string with the complete URL of the target server</p></li><li><p>Convert xml-rpc boolean values into native php values instead
of 0 and 1</p></li><li><p>Force the <code class="code">php_xmlrpc_encode</code> function to properly
encode numerically indexed php arrays into xml-rpc arrays
(numerically indexed php arrays always start with a key of 0 and
increment keys by values of 1)</p></li><li><p>Prevent the <code class="code">php_xmlrpc_encode</code> function from
further re-encoding any objects of class <code class="code">xmlrpcval</code> that
are passed to it. This allows to call the function with arguments
consisting of mixed php values / xmlrpcval objects.</p></li><li><p>Allow a server to NOT respond to system.* method calls
(setting the <code class="code">$server-&gt;allow_system_funcs</code>
property).</p></li><li><p>Implement a new xmlrpcval method to determine if a value of
type struct has a member of a given name without having to loop
trough all members: <code class="code">xmlrpcval::structMemExists()</code></p></li><li><p>Expand methods <code class="code">xmlrpcval::addArray</code>,
<code class="code">addScalar</code> and <code class="code">addStruct</code> allowing extra php
values to be added to xmlrpcval objects already formed.</p></li><li><p>Let the <code class="code">xmlrpc_client::send</code> method accept an XML
string for sending instead of an xmlrpcmsg object, to facilitate
debugging and integration with the php native xmlrpc
extension</p></li><li><p>Extend the <code class="code">php_xmlrpc_encode</code> and
<code class="code">php_xmlrpc_decode</code> functions to allow serialization and
rebuilding of PHP objects. To successfully rebuild a serialized
object, the object class must be defined in the deserializing end of
the transfer. Note that object members of type resource will be
deserialized as NULL values.</p><p>Note that his has been implemented adding a "php_class"
attribute to xml representation of xmlrpcval of STRUCT type, which,
strictly speaking, breaks the xml-rpc spec. Other xmlrpc
implementations are supposed to ignore such an attribute (unless
they implement a brain-dead custom xml parser...), so it should be
safe enabling it in heterogeneous environments. The activation of
this feature is done by usage of an option passed as second
parameter to both <code class="code">php_xmlrpc_encode</code> and
<code class="code">php_xmlrpc_decode</code>.</p></li><li><p>Extend the <code class="code">php_xmlrpc_encode</code> function to allow
automatic serialization of iso8601-conforming php strings as
datetime.iso8601 xmlrpcvals, by usage of an optional
parameter</p></li><li><p>Added an automatic stub code generator for converting xmlrpc
methods to php functions and vice-versa.</p><p>This is done via two new functions:
<code class="code">wrap_php_function</code> and <code class="code">wrap_xmlrpc_method</code>,
and has many caveats, with php being a typeless language and
all...</p><p>With PHP versions lesser than 5.0.3 wrapping of php functions
into xmlrpc methods is not supported yet.</p></li><li><p>Allow object methods to be used in server dispatch map</p></li><li><p>Added a complete debugger solution, in the
<code class="filename">debugger</code> folder</p></li><li><p>Added configurable server-side debug messages, controlled by
the new method <code class="code">xmlrpc_server::SetDebug()</code>. At level 0,
no debug messages are sent to the client; level 1 is the same as the
old behaviour; at level 2 a lot more info is echoed back to the
client, regarding the received call; at level 3 all warnings raised
during server processing are trapped (this prevents breaking the xml
to be echoed back to the client) and added to the debug info sent
back to the client</p></li><li><p>New XML parsing code, yields smaller memory footprint and
faster execution times, not to mention complete elimination of the
dreaded <code class="filename">eval()</code> construct, so prone to code
injection exploits</p></li><li><p>Rewritten most of the error messages, making text more
explicative</p></li></ul></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s08.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.0 Release candidate 2 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 3. System Requirements</td></tr></table></div></body></html>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 3. System Requirements</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch02s09.html" title="2.0 Release candidate 1" /><link rel="next" href="ch04.html" title="Chapter 4. Files in the distribution" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 3. System Requirements</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s09.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="requirements"></a>Chapter 3. System Requirements</h2></div></div></div><p>The library has been designed with goals of scalability and backward
compatibility. As such, it supports a wide range of PHP installs. Note
that not all features of the lib are available in every
configuration.</p><p>The <span class="emphasis"><em>minimum supported</em></span> PHP version is
5.0.</p><p>Automatic generation of xml-rpc methods from php functions is only
supported with PHP version 5.0.3 and later (note that the lib will
generate some warnings with PHP 5 in strict error reporting mode).</p><p>If you wish to use SSL or HTTP 1.1 to communicate with remote
servers, you need the "curl" extension compiled into your PHP
installation.</p><p>The "xmlrpc" native extension is not required to be compiled into
your PHP installation, but if it is, there will be no interference with
the operation of this library.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s09.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.0 Release candidate 1 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. Files in the distribution</td></tr></table></div></body></html>

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 4. Files in the distribution</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch03.html" title="Chapter 3. System Requirements" /><link rel="next" href="ch05.html" title="Chapter 5. Known bugs and limitations" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 4. Files in the distribution</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch05.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manifest"></a>Chapter 4. Files in the distribution</h2></div></div></div><div class="glosslist"><dl><dt>lib/xmlrpc.inc</dt><dd><p>the XML-RPC classes. <code class="function">include()</code> this in
your PHP files to use the classes.</p></dd><dt>lib/xmlrpcs.inc</dt><dd><p>the XML-RPC server class. <code class="function">include()</code> this
in addition to xmlrpc.inc to get server functionality</p></dd><dt>lib/xmlrpc_wrappers.inc</dt><dd><p>helper functions to "automagically" convert plain php
functions to xmlrpc services and vice versa</p></dd><dt>demo/server/proxy.php</dt><dd><p>a sample server implementing xmlrpc proxy
functionality.</p></dd><dt>demo/server/server.php</dt><dd><p>a sample server hosting various demo functions, as well as a
full suite of functions used for interoperability testing. It is
used by testsuite.php (see below) for unit testing the library, and
is not to be copied literally into your production servers</p></dd><dt>demo/client/client.php, demo/client/agesort.php,
demo/client/which.php</dt><dd><p>client code to exercise some of the functions in server.php,
including the <code class="function">interopEchoTests.whichToolkit</code>
method.</p></dd><dt>demo/client/wrap.php</dt><dd><p>client code to illustrate 'wrapping' of remote methods into
php functions.</p></dd><dt>demo/client/introspect.php</dt><dd><p>client code to illustrate usage of introspection capabilities
offered by server.php.</p></dd><dt>demo/client/mail.php</dt><dd><p>client code to illustrate usage of an xmlrpc-to-email gateway
using Dave Winer's XML-RPC server at userland.com.</p></dd><dt>demo/client/zopetest.php</dt><dd><p>example client code that queries an xmlrpc server built in
Zope.</p></dd><dt>demo/vardemo.php</dt><dd><p>examples of how to construct xmlrpcval types</p></dd><dt>demo/demo1.txt, demo/demo2.txt, demo/demo3.txt</dt><dd><p>XML-RPC responses captured in a file for testing purposes (you
can use these to test the
<code class="function">xmlrpcmsg-&gt;parseResponse()</code> method).</p></dd><dt>demo/server/discuss.php,
demo/client/comment.php</dt><dd><p>Software used in the PHP chapter of <a class="xref" href="ch06s02.html" title="The Jellyfish Book">The Jellyfish Book</a> to provide a comment server and allow the
attachment of comments to stories from Meerkat's data store.</p></dd><dt>test/testsuite.php, test/parse_args.php</dt><dd><p>A unit test suite for this software package. If you do
development on this software, please consider submitting tests for
this suite.</p></dd><dt>test/benchmark.php</dt><dd><p>A (very limited) benchmarking suite for this software package.
If you do development on this software, please consider submitting
benchmarks for this suite.</p></dd><dt>test/phpunit.php, test/PHPUnit/*.php</dt><dd><p>An (incomplete) version PEAR's unit test framework for PHP.
The complete package can be found at <a class="ulink" href="http://pear.php.net/package/PHPUnit" target="_top">http://pear.php.net/package/PHPUnit</a></p></dd><dt>test/verify_compat.php</dt><dd><p>Script designed to help the user to verify the level of
compatibility of the library with the current php install</p></dd><dt>extras/test.pl, extras/test.py</dt><dd><p>Perl and Python programs to exercise server.php to test that
some of the methods work.</p></dd><dt>extras/workspace.testPhpServer.fttb</dt><dd><p>Frontier scripts to exercise the demo server. Thanks to Dave
Winer for permission to include these. See <a class="ulink" href="http://www.xmlrpc.com/discuss/msgReader$853" target="_top">Dave's
announcement of these.</a></p></dd><dt>extras/rsakey.pem</dt><dd><p>A test certificate key for the SSL support, which can be used
to generate dummy certificates. It has the passphrase "test."</p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. System Requirements </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. Known bugs and limitations</td></tr></table></div></body></html>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 5. Known bugs and limitations</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch04.html" title="Chapter 4. Files in the distribution" /><link rel="next" href="ch06.html" title="Chapter 6. Support" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 5. Known bugs and limitations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="bugs"></a>Chapter 5. Known bugs and limitations</h2></div></div></div><p>This started out as a bare framework. Many "nice" bits haven't been
put in yet. Specifically, very little type validation or coercion has been
put in. PHP being a loosely-typed language, this is going to have to be
done explicitly (in other words: you can call a lot of library functions
passing them arguments of the wrong type and receive an error message only
much further down the code, where it will be difficult to
understand).</p><p>dateTime.iso8601 is supported opaquely. It can't be done natively as
the XML-RPC specification explicitly forbids passing of timezone
specifiers in ISO8601 format dates. You can, however, use the <a class="xref" href="ch09.html#iso8601encode" title="iso8601_encode">iso8601_encode()</a> and <a class="xref" href="ch09.html#iso8601decode" title="iso8601_decode">iso8601_decode()</a> functions
to do the encoding and decoding for you.</p><p>Very little HTTP response checking is performed (e.g. HTTP redirects
are not followed and the Content-Length HTTP header, mandated by the
xml-rpc spec, is not validated); cookie support still involves quite a bit
of coding on the part of the user.</p><p>If a specific character set encoding other than US-ASCII, ISO-8859-1
or UTF-8 is received in the HTTP header or XML prologue of xml-rpc request
or response messages then it will be ignored for the moment, and the
content will be parsed as if it had been encoded using the charset defined
by <a class="xref" href="ch08s02.html#xmlrpc-defencoding" title="xmlrpc_defencoding">xmlrpc_defencoding</a></p><p>Support for receiving from servers version 1 cookies (i.e.
conforming to RFC 2965) is quite incomplete, and might cause unforeseen
errors.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. Files in the distribution </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. Support</td></tr></table></div></body></html>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 6. Support</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch05.html" title="Chapter 5. Known bugs and limitations" /><link rel="next" href="ch06s02.html" title="The Jellyfish Book" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch06s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="support"></a>Chapter 6. Support</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch06.html#id932516">Online Support</a></span></dt><dt><span class="sect1"><a href="ch06s02.html">The Jellyfish Book</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id932516"></a>Online Support</h2></div></div></div><p>XML-RPC for PHP is offered "as-is" without any warranty or
commitment to support. However, informal advice and help is available
via the XML-RPC for PHP website and mailing list and from
XML-RPC.com.</p><div class="itemizedlist"><ul type="disc"><li><p>The <span class="emphasis"><em>XML-RPC for PHP</em></span> development is hosted
on <a class="ulink" href="http://phpxmlrpc.sourceforge.net" target="_top">phpxmlrpc.sourceforge.net</a>.
Bugs, feature requests and patches can be posted to the <a class="ulink" href="http://sourceforge.net/projects/phpxmlrpc" target="_top">project's
website</a>.</p></li><li><p>The <span class="emphasis"><em>PHP XML-RPC interest mailing list</em></span> is
run by the author. More details <a class="ulink" href="http://lists.gnomehack.com/mailman/listinfo/phpxmlrpc" target="_top">can be
found here</a>.</p></li><li><p>For more general XML-RPC questions, there is a Yahoo! Groups
<a class="ulink" href="http://groups.yahoo.com/group/xml-rpc/" target="_top">XML-RPC mailing
list</a>.</p></li><li><p>The <a class="ulink" href="http://www.xmlrpc.com/discuss" target="_top">XML-RPC.com</a> discussion
group is a useful place to get help with using XML-RPC. This group
is also gatewayed into the Yahoo! Groups mailing list.</p></li></ul></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch06s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Known bugs and limitations </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The Jellyfish Book</td></tr></table></div></body></html>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Jellyfish Book</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch06.html" title="Chapter 6. Support" /><link rel="prev" href="ch06.html" title="Chapter 6. Support" /><link rel="next" href="ch07.html" title="Chapter 7. Class documentation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The Jellyfish Book</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><th width="60%" align="center">Chapter 6. Support</th><td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="jellyfish"></a>The Jellyfish Book</h2></div></div></div><div align="right"><table border="0" summary="manufactured viewport for HTML img" cellspacing="0" cellpadding="0" width="145"><tr style="height: 190px"><td align="right"><img src="progxmlrpc.s.gif" align="right" width="145" /></td></tr></table></div><p>Together with Simon St.Laurent and Joe
Johnston, Edd Dumbill wrote a book on XML-RPC for O'Reilly and
Associates on XML-RPC. It features a rather fetching jellyfish on the
cover.</p><p>Complete details of the book are <a class="ulink" href="http://www.oreilly.com/catalog/progxmlrpc/" target="_top">available from
O'Reilly's web site.</a></p><p>Edd is responsible for the chapter on PHP, which includes a worked
example of creating a forum server, and hooking it up the O'Reilly's
<a class="ulink" href="http://meerkat.oreillynet.com/" target="_top">Meerkat</a> service in
order to allow commenting on news stories from around the Web.</p><p>If you've benefited from the effort that has been put into writing
this software, then please consider buying the book!</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 6. Support </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Class documentation</td></tr></table></div></body></html>

View File

@@ -1,109 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 7. Class documentation</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch06s02.html" title="The Jellyfish Book" /><link rel="next" href="ch07s02.html" title="xmlrpcmsg" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 7. Class documentation</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="apidocs"></a>Chapter 7. Class documentation</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch07.html#xmlrpcval">xmlrpcval</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07.html#id932680">Notes on types</a></span></dt><dt><span class="sect2"><a href="ch07.html#xmlrpcval-creation">Creation</a></span></dt><dt><span class="sect2"><a href="ch07.html#xmlrpcval-methods">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s02.html">xmlrpcmsg</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s02.html#id934064">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s02.html#id934152">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s03.html">xmlrpc_client</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s03.html#id934526">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s03.html#id934666">Methods</a></span></dt><dt><span class="sect2"><a href="ch07s03.html#id935796">Variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s04.html">xmlrpcresp</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s04.html#id935884">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s04.html#id935971">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s05.html">xmlrpc_server</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s05.html#id936390">Method handler functions</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936453">The dispatch map</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#signatures">Method signatures</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936613">Delaying the server response</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936662">Modifying the server behaviour</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936748">Fault reporting</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id937308">'New style' servers</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xmlrpcval"></a>xmlrpcval</h2></div></div></div><p>This is where a lot of the hard work gets done. This class enables
the creation and encapsulation of values for XML-RPC.</p><p>Ensure you've read the XML-RPC spec at <a class="ulink" href="http://www.xmlrpc.com/stories/storyReader$7" target="_top">http://www.xmlrpc.com/stories/storyReader$7</a>
before reading on as it will make things clearer.</p><p>The <code class="classname">xmlrpcval</code> class can store arbitrarily
complicated values using the following types: <code class="literal">i4 int boolean
string double dateTime.iso8601 base64 array struct</code>
<code class="literal">null</code>. You should refer to the <a class="ulink" href="http://www.xmlrpc.com/spec" target="_top">spec</a> for more information on
what each of these types mean.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id932680"></a>Notes on types</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932686"></a>int</h4></div></div></div><p>The type <code class="classname">i4</code> is accepted as a synonym
for <code class="classname">int</code> when creating xmlrpcval objects. The
xml parsing code will always convert <code class="classname">i4</code> to
<code class="classname">int</code>: <code class="classname">int</code> is regarded
by this implementation as the canonical name for this type.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932715"></a>base64</h4></div></div></div><p>Base 64 encoding is performed transparently to the caller when
using this type. Decoding is also transparent. Therefore you ought
to consider it as a "binary" data type, for use when you want to
pass data that is not 7-bit clean.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932726"></a>boolean</h4></div></div></div><p>The php values <code class="literal">true</code> and
<code class="literal">1</code> map to <code class="literal">true</code>. All other
values (including the empty string) are converted to
<code class="literal">false</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932751"></a>string</h4></div></div></div><p>Characters &lt;, &gt;, ', ", &amp;, are encoded using their
entity reference as &amp;lt; &amp;gt; &amp;apos; &amp;quot; and
&amp;amp; All other characters outside of the ASCII range are
encoded using their character reference representation (e.g.
&amp;#200 for é). The XML-RPC spec recommends only encoding
<code class="literal">&lt; &amp;</code> but this implementation goes further,
for reasons explained by <a class="ulink" href="http://www.w3.org/TR/REC-xml#syntax" target="_top">the XML 1.0
recommendation</a>. In particular, using character reference
representation has the advantage of producing XML that is valid
independently of the charset encoding assumed.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id932770"></a>null</h4></div></div></div><p>There is no support for encoding <code class="literal">null</code>
values in the XML-RPC spec, but at least a couple of extensions (and
many toolkits) do support it. Before using <code class="literal">null</code>
values in your messages, make sure that the responding party accepts
them, and uses the same encoding convention (see ...).</p></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="xmlrpcval-creation"></a>Creation</h3></div></div></div><p>The constructor is the normal way to create an
<code class="classname">xmlrpcval</code>. The constructor can take these
forms:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td>string<var class="pdparam">$stringVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td>mixed<var class="pdparam">$scalarVal</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$scalartyp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcvalnew
<b class="fsfunc">xmlrpcval</b>(</code></td><td>array<var class="pdparam">$arrayVal</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$arraytyp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>The first constructor creates an empty value, which must be
altered using the methods <code class="function">addScalar</code>,
<code class="function">addArray</code> or <code class="function">addStruct</code> before
it can be used.</p><p>The second constructor creates a simple string value.</p><p>The third constructor is used to create a scalar value. The
second parameter must be a name of an XML-RPC type. Valid types are:
"<code class="literal">int</code>", "<code class="literal">boolean</code>",
"<code class="literal">string</code>", "<code class="literal">double</code>",
"<code class="literal">dateTime.iso8601</code>", "<code class="literal">base64</code>" or
"null".</p><p>Examples:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$myInt&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #0000BB">1267</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$myString&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #DD0000">"Hello,&nbsp;World!"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$myBool&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"boolean"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$myString2&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcvalue</span><span style="color: #007700">(</span><span style="color: #0000BB">1.24</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;note:&nbsp;this&nbsp;will&nbsp;serialize&nbsp;a&nbsp;php&nbsp;float&nbsp;value&nbsp;as&nbsp;xmlrpc&nbsp;string</span>
</span>
</code></pre><p>The fourth constructor form can be used to compose complex
XML-RPC values. The first argument is either a simple array in the
case of an XML-RPC <code class="classname">array</code> or an associative
array in the case of a <code class="classname">struct</code>. The elements of
the array <span class="emphasis"><em>must be <code class="classname">xmlrpcval</code> objects
themselves</em></span>.</p><p>The second parameter must be either "<code class="literal">array</code>"
or "<code class="literal">struct</code>".</p><p>Examples:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$myArray&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(<br />&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Tom"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Dick"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Harry"</span><span style="color: #007700">)<br />&nbsp;&nbsp;),<br />&nbsp;&nbsp;</span><span style="color: #DD0000">"array"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;recursive&nbsp;struct<br /></span><span style="color: #0000BB">$myStruct&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(<br />&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"name"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Tom"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"age"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #0000BB">34</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"address"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"street"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"Fifht&nbsp;Ave"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"city"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"NY"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"struct"</span><span style="color: #007700">)<br />&nbsp;&nbsp;),&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #DD0000">"struct"</span><span style="color: #007700">);</span>
</span>
</code></pre><p>See the file <code class="literal">vardemo.php</code> in this distribution
for more examples.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="xmlrpcval-methods"></a>Methods</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933111"></a>addScalar</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addScalar</b>(</code></td><td>string<var class="pdparam">$stringVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addScalar</b>(</code></td><td>mixed<var class="pdparam">$scalarVal</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$scalartyp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <em class="parameter"><code>$val</code></em> is an empty
<code class="classname">xmlrpcval</code> this method makes it a scalar
value, and sets that value.</p><p>If <em class="parameter"><code>$val</code></em> is already a scalar value, then
no more scalars can be added and <code class="literal">0</code> is
returned.</p><p>If <em class="parameter"><code>$val</code></em> is an xmlrpcval of type array,
the php value <em class="parameter"><code>$scalarval</code></em> is added as its last
element.</p><p>If all went OK, <code class="literal">1</code> is returned, otherwise
<code class="literal">0</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933209"></a>addArray</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addArray</b>(</code></td><td>array<var class="pdparam">$arrayVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>The argument is a simple (numerically indexed) array. The
elements of the array <span class="emphasis"><em>must be
<code class="classname">xmlrpcval</code> objects
themselves</em></span>.</p><p>Turns an empty <code class="classname">xmlrpcval</code> into an
<code class="classname">array</code> with contents as specified by
<em class="parameter"><code>$arrayVal</code></em>.</p><p>If <em class="parameter"><code>$val</code></em> is an xmlrpcval of type array,
the elements of <em class="parameter"><code>$arrayVal</code></em> are appended to the
existing ones.</p><p>See the fourth constructor form for more information.</p><p>If all went OK, <code class="literal">1</code> is returned, otherwise
<code class="literal">0</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933290"></a>addStruct</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">addStruct</b>(</code></td><td>array<var class="pdparam">$assocArrayVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>The argument is an associative array. The elements of the
array <span class="emphasis"><em>must be <code class="classname">xmlrpcval</code> objects
themselves</em></span>.</p><p>Turns an empty <code class="classname">xmlrpcval</code> into a
<code class="classname">struct</code> with contents as specified by
<em class="parameter"><code>$assocArrayVal</code></em>.</p><p>If <em class="parameter"><code>$val</code></em> is an xmlrpcval of type struct,
the elements of <em class="parameter"><code>$arrayVal</code></em> are merged with the
existing ones.</p><p>See the fourth constructor form for more information.</p><p>If all went OK, <code class="literal">1</code> is returned, otherwise
<code class="literal">0</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933370"></a>kindOf</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">kindOf</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a string containing "struct", "array" or "scalar"
describing the base type of the value. If it returns "undef" it
means that the value hasn't been initialised.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933398"></a>serialize</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">serialize</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a string containing the XML-RPC representation of this
value.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933425"></a>scalarVal</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">mixed<b class="fsfunc">scalarVal</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "scalar"</code>, this
method returns the actual PHP-language value of the scalar (base 64
decoding is automatically handled here).</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933457"></a>scalarTyp</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">scalarTyp</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "scalar"</code>, this
method returns a string denoting the type of the scalar. As
mentioned before, <code class="literal">i4</code> is always coerced to
<code class="literal">int</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933779"></a>arrayMem</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">arrayMem</b>(</code></td><td>int<var class="pdparam">$n</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "array"</code>, returns
the <em class="parameter"><code>$n</code></em>th element in the array represented by
the value <em class="parameter"><code>$val</code></em>. The value returned is an
<code class="classname">xmlrpcval</code> object.</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;iterating&nbsp;over&nbsp;values&nbsp;of&nbsp;an&nbsp;array&nbsp;object<br /></span><span style="color: #007700">for&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">arraySize</span><span style="color: #007700">();&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++)<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">arrayMem</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">);<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Element&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #DD0000">&nbsp;of&nbsp;the&nbsp;array&nbsp;is&nbsp;of&nbsp;type&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$v</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">kindOf</span><span style="color: #007700">();<br />}</span>
</span>
</code></pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933833"></a>arraySize</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">arraySize</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <em class="parameter"><code>$val</code></em> is an
<code class="classname">array</code>, returns the number of elements in that
array.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933869"></a>structMem</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">structMem</b>(</code></td><td>string<var class="pdparam">$memberName</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>If <code class="function">$val-&gt;kindOf() == "struct"</code>, returns
the element called <em class="parameter"><code>$memberName</code></em> from the
struct represented by the value <em class="parameter"><code>$val</code></em>. The
value returned is an <code class="classname">xmlrpcval</code> object.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id933915"></a>structEach</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">array<b class="fsfunc">structEach</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the next (key, value) pair from the struct, when
<em class="parameter"><code>$val</code></em> is a struct.
<em class="parameter"><code>$value</code></em> is an xmlrpcval itself. See also <a class="xref" href="ch07.html#structreset" title="structReset">structreset()</a>.</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;iterating&nbsp;over&nbsp;all&nbsp;values&nbsp;of&nbsp;a&nbsp;struct&nbsp;object<br /></span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">structreset</span><span style="color: #007700">();<br />while&nbsp;(list(</span><span style="color: #0000BB">$key</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$v</span><span style="color: #007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">structEach</span><span style="color: #007700">())<br />{<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Element&nbsp;</span><span style="color: #0000BB">$key</span><span style="color: #DD0000">&nbsp;of&nbsp;the&nbsp;struct&nbsp;is&nbsp;of&nbsp;type&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">$v</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">kindOf</span><span style="color: #007700">();<br />}</span>
</span>
</code></pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="structreset"></a>structReset</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">structReset</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Resets the internal pointer for
<code class="function">structEach()</code> to the beginning of the struct,
where <em class="parameter"><code>$val</code></em> is a struct.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="structmemexists"></a>structMemExists</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">bool<b class="fsfunc">structMemExsists</b>(</code></td><td>string<var class="pdparam">$memberName</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns <code class="constant">TRUE</code> or
<code class="constant">FALSE</code> depending on whether a member of the
given name exists in the struct.</p></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06s02.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch07s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The Jellyfish Book </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> xmlrpcmsg</td></tr></table></div></body></html>

View File

@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>xmlrpcmsg</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link rel="prev" href="ch07.html" title="Chapter 7. Class documentation" /><link rel="next" href="ch07s03.html" title="xmlrpc_client" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">xmlrpcmsg</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Class documentation</th><td width="20%" align="right"> <a accesskey="n" href="ch07s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xmlrpcmsg"></a>xmlrpcmsg</h2></div></div></div><p>This class provides a representation for a request to an XML-RPC
server. A client sends an <code class="classname">xmlrpcmsg</code> to a server,
and receives back an <code class="classname">xmlrpcresp</code> (see <a class="xref" href="ch07s03.html#xmlrpc-client-send" title="send">xmlrpc_client-&gt;send</a>).</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id934064"></a>Creation</h3></div></div></div><p>The constructor takes the following forms:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcmsgnew
<b class="fsfunc">xmlrpcmsg</b>(</code></td><td>string<var class="pdparam">$methodName</var>, </td></tr><tr><td> </td><td>array<var class="pdparam">$parameterArray</var>null<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Where <em class="parameter"><code>methodName</code></em> is a string indicating
the name of the method you wish to invoke, and
<em class="parameter"><code>parameterArray</code></em> is a simple php
<code class="classname">Array</code> of <code class="classname">xmlrpcval</code>
objects. Here's an example message to the <span class="emphasis"><em>US state
name</em></span> server:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$msg&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span style="color: #DD0000">"examples.getStateName"</span><span style="color: #007700">,&nbsp;array(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #0000BB">23</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span style="color: #007700">)));</span>
</span>
</code></pre><p>This example requests the name of state number 23. For more
information on <code class="classname">xmlrpcval</code> objects, see <a class="xref" href="ch07.html#xmlrpcval" title="xmlrpcval">xmlrpcval</a>.</p><p>Note that the <em class="parameter"><code>parameterArray</code></em> parameter is
optional and can be omitted for methods that take no input parameters
or if you plan to add parameters one by one.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id934152"></a>Methods</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id934158"></a>addParam</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">bool<b class="fsfunc">addParam</b>(</code></td><td>xmlrpcval<var class="pdparam">$xmlrpcVal</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Adds the <code class="classname">xmlrpcval</code>
<em class="parameter"><code>xmlrpcVal</code></em> to the parameter list for this
method call. Returns TRUE or FALSE on error.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id934197"></a>getNumParams</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">getNumParams</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the number of parameters attached to this
message.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id934225"></a>getParam</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">getParam</b>(</code></td><td>int<var class="pdparam">$n</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Gets the <em class="parameter"><code>n</code></em>th parameter in the message
(with the index zero-based). Use this method in server
implementations to retrieve the values sent by the client.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id934261"></a>method</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">method</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">method</b>(</code></td><td>string<var class="pdparam">$methName</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Gets or sets the method contained in the XML-RPC
message.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id934392"></a>parseResponse</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcresp<b class="fsfunc">parseResponse</b>(</code></td><td>string<var class="pdparam">$xmlString</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Given an incoming XML-RPC server response contained in the
string <em class="parameter"><code>$xmlString</code></em>, this method constructs an
<code class="classname">xmlrpcresp</code> response object and returns it,
setting error codes as appropriate (see <a class="xref" href="ch07s03.html#xmlrpc-client-send" title="send">xmlrpc_client-&gt;send</a>).</p><p>This method processes any HTTP/MIME headers it finds.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id934438"></a>parseResponseFile</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcresp<b class="fsfunc">parseResponseFile</b>(</code></td><td>file handle
resource<var class="pdparam">$fileHandle</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Given an incoming XML-RPC server response on the open file
handle <em class="parameter"><code>fileHandle</code></em>, this method reads all the
data it finds and passes it to
<code class="function">parseResponse.</code></p><p>This method is useful to construct responses from pre-prepared
files (see files <code class="literal">demo1.txt, demo2.txt, demo3.txt</code>
in this distribution). It processes any HTTP headers it finds, and
does not close the file handle.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id934484"></a>serialize</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string
<b class="fsfunc">serialize</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the an XML string representing the XML-RPC
message.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. Class documentation </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> xmlrpc_client</td></tr></table></div></body></html>

View File

@@ -1,195 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>xmlrpc_client</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link rel="prev" href="ch07s02.html" title="xmlrpcmsg" /><link rel="next" href="ch07s04.html" title="xmlrpcresp" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">xmlrpc_client</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s02.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Class documentation</th><td width="20%" align="right"> <a accesskey="n" href="ch07s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xmlrpc-client"></a>xmlrpc_client</h2></div></div></div><p>This is the basic class used to represent a client of an XML-RPC
server.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id934526"></a>Creation</h3></div></div></div><p>The constructor accepts one of two possible syntaxes:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpc_clientnew
<b class="fsfunc">xmlrpc_client</b>(</code></td><td>string<var class="pdparam">$server_url</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpc_clientnew
<b class="fsfunc">xmlrpc_client</b>(</code></td><td>string<var class="pdparam">$server_path</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$server_hostname</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$server_port</var>80, </td></tr><tr><td> </td><td>string<var class="pdparam">$transport</var>'http'<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Here are a couple of usage examples of the first form:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://phpxmlrpc.sourceforge.net/server.php"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$another_client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">"https://james:bond@secret.service.com:443/xmlrpcserver?agent=007"</span><span style="color: #007700">);</span>
</span>
</code></pre><p>The second syntax does not allow to express a username and
password to be used for basic HTTP authorization as in the second
example above, but instead it allows to choose whether xmlrpc calls
will be made using the HTTP 1.0 or 1.1 protocol.</p><p>Here's another example client set up to query Userland's XML-RPC
server at <span class="emphasis"><em>betty.userland.com</em></span>:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">"/RPC2"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"betty.userland.com"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">);</span>
</span>
</code></pre><p>The <em class="parameter"><code>server_port</code></em> parameter is optional,
and if omitted will default to 80 when using HTTP and 443 when using
HTTPS (see the <a class="xref" href="ch07s03.html#xmlrpc-client-send" title="send">xmlrpc_client-&gt;send</a> method
below).</p><p>The <em class="parameter"><code>transport</code></em> parameter is optional, and
if omitted will default to 'http'. Allowed values are either
'<span class="symbol">http'</span>, '<span class="symbol">https</span>' or
'<span class="symbol">http11'</span>. Its value can be overridden with every call
to the <code class="methodname">send</code> method. See the
<code class="methodname">send</code> method below for more details about the
meaning of the different values.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id934666"></a>Methods</h3></div></div></div><p>This class supports the following methods.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="xmlrpc-client-send"></a>send</h4></div></div></div><p>This method takes the forms:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcresp<b class="fsfunc">send</b>(</code></td><td>xmlrpcmsg<var class="pdparam">$xmlrpc_message</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$transport</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">array<b class="fsfunc">send</b>(</code></td><td>array<var class="pdparam">$xmlrpc_messages</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$transport</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcresp<b class="fsfunc">send</b>(</code></td><td>string<var class="pdparam">$xml_payload</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$transport</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Where <em class="parameter"><code>xmlrpc_message</code></em> is an instance of
<code class="classname">xmlrpcmsg</code> (see <a class="xref" href="ch07s02.html" title="xmlrpcmsg">xmlrpcmsg</a>),
and <em class="parameter"><code>response</code></em> is an instance of
<code class="classname">xmlrpcresp</code> (see <a class="xref" href="ch07s04.html" title="xmlrpcresp">xmlrpcresp</a>).</p><p><em class="parameter"><code>If xmlrpc_messages</code></em> is an array of
message instances, <code class="code">responses</code> will be an array of
response instances. The client will try to make use of a single
<code class="code">system.multicall</code> xml-rpc method call to forward to the
server all the messages in a single HTTP round trip, unless
<code class="code">$client-&gt;no_multicall</code> has been previously set to
<code class="code">TRUE</code> (see the multicall method below), in which case
many consecutive xmlrpc requests will be sent.</p><p>The third syntax allows to build by hand (or any other means)
a complete xmlrpc request message, and send it to the server.
<em class="parameter"><code>xml_payload</code></em> should be a string containing the
complete xml representation of the request. It is e.g. useful when,
for maximal speed of execution, the request is serialized into a
string using the native php xmlrpc functions (see <a class="ulink" href="http://www.php.net/xmlrpc" target="_top">the php manual on
xmlrpc</a>).</p><p>The <em class="parameter"><code>timeout</code></em> is optional, and will be
set to <code class="literal">0</code> (wait for platform-specific predefined
timeout) if omitted. This timeout value is passed to
<code class="function">fsockopen()</code>. It is also used for detecting
server timeouts during communication (i.e. if the server does not
send anything to the client for <em class="parameter"><code>timeout</code></em>
seconds, the connection will be closed).</p><p>The <em class="parameter"><code>transport</code></em> parameter is optional,
and if omitted will default to the transport set using instance
creator or 'http' if omitted. The only other valid values are
'https', which will use an SSL HTTP connection to connect to the
remote server, and 'http11'. Note that your PHP must have the "curl"
extension compiled in order to use both these features. Note that
when using SSL you should normally set your port number to 443,
unless the SSL server you are contacting runs at any other
port.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>PHP 4.0.6 has a bug which prevents SSL working.</p></div><p>In addition to low-level errors, the XML-RPC server you were
querying may return an error in the
<code class="classname">xmlrpcresp</code> object. See <a class="xref" href="ch07s04.html" title="xmlrpcresp">xmlrpcresp</a> for details of how to handle these
errors.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="multicall"></a>multiCall</h4></div></div></div><p>This method takes the form:</p><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">array<b class="fsfunc">multiCall</b>(</code></td><td>array<var class="pdparam">$messages</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$timeout</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$transport</var>, </td></tr><tr><td> </td><td>bool<var class="pdparam">$fallback</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method is used to boxcar many method calls in a single
xml-rpc request. It will try first to make use of the
<code class="code">system.multicall</code> xml-rpc method call, and fall back to
executing many separate requests if the server returns any
error.</p><p><em class="parameter"><code>msgs</code></em> is an array of
<code class="classname">xmlrpcmsg</code> objects (see <a class="xref" href="ch07s02.html" title="xmlrpcmsg">xmlrpcmsg</a>), and <em class="parameter"><code>response</code></em> is an
array of <code class="classname">xmlrpcresp</code> objects (see <a class="xref" href="ch07s04.html" title="xmlrpcresp">xmlrpcresp</a>).</p><p>The <em class="parameter"><code>timeout</code></em> and
<em class="parameter"><code>transport</code></em> parameters are optional, and behave
as in the <code class="methodname">send</code> method above.</p><p>The <em class="parameter"><code>fallback</code></em> parameter is optional, and
defaults to <code class="constant">TRUE</code>. When set to
<code class="constant">FALSE</code> it will prevent the client to try using
many single method calls in case of failure of the first multicall
request. It should be set only when the server is known to support
the multicall extension.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935048"></a>setAcceptedCompression</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setAcceptedCompression</b>(</code></td><td>string<var class="pdparam">$compressionmethod</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method defines whether the client will accept compressed
xml payload forming the bodies of the xmlrpc responses received from
servers. Note that enabling reception of compressed responses merely
adds some standard http headers to xmlrpc requests. It is up to the
xmlrpc server to return compressed responses when receiving such
requests. Allowed values for
<em class="parameter"><code>compressionmethod</code></em> are: 'gzip', 'deflate',
'any' or null (with any meaning either gzip or deflate).</p><p>This requires the "zlib" extension to be enabled in your php
install. If it is, by default <code class="classname">xmlrpc_client</code>
instances will enable reception of compressed content.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935091"></a>setCaCertificate</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setCaCertificate</b>(</code></td><td>string<var class="pdparam">$certificate</var>, </td></tr><tr><td> </td><td>bool<var class="pdparam">$is_dir</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method sets an optional certificate to be used in
SSL-enabled communication to validate a remote server with (when the
<em class="parameter"><code>server_method</code></em> is set to 'https' in the
client's construction or in the send method and
<code class="methodname">SetSSLVerifypeer</code> has been set to
<code class="constant">TRUE</code>).</p><p>The <em class="parameter"><code>certificate</code></em> parameter must be the
filename of a PEM formatted certificate, or a directory containing
multiple certificate files. The <em class="parameter"><code>is_dir</code></em>
parameter defaults to <code class="constant">FALSE</code>, set it to
<code class="constant">TRUE</code> to specify that
<em class="parameter"><code>certificate</code></em> indicates a directory instead of
a single file.</p><p>This requires the "curl" extension to be compiled into your
installation of PHP. For more details see the man page for the
<code class="function">curl_setopt</code> function.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935172"></a>setCertificate</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setCertificate</b>(</code></td><td>string<var class="pdparam">$certificate</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$passphrase</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method sets the optional certificate and passphrase used
in SSL-enabled communication with a remote server (when the
<em class="parameter"><code>server_method</code></em> is set to 'https' in the
client's construction or in the send method).</p><p>The <em class="parameter"><code>certificate</code></em> parameter must be the
filename of a PEM formatted certificate. The
<em class="parameter"><code>passphrase</code></em> parameter must contain the
password required to use the certificate.</p><p>This requires the "curl" extension to be compiled into your
installation of PHP. For more details see the man page for the
<code class="function">curl_setopt</code> function.</p><p>Note: to retrieve information about the client certificate on
the server side, you will need to look into the environment
variables which are set up by the webserver. Different webservers
will typically set up different variables.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935237"></a>setCookie</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setCookie</b>(</code></td><td>string<var class="pdparam">$name</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$value</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$path</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$domain</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$port</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method sets a cookie that will be sent to the xmlrpc
server along with every further request (useful e.g. for keeping
session info outside of the xml-rpc payload).</p><p><em class="parameter"><code>$value</code></em> is optional, and defaults to
null.</p><p><em class="parameter"><code>$path, $domain and $port</code></em> are optional,
and will be omitted from the cookie header if unspecified. Note that
setting any of these values will turn the cookie into a 'version 1'
cookie, that might not be fully supported by the server (see RFC2965
for more details).</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935310"></a>setCredentials</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setCredentials</b>(</code></td><td>string<var class="pdparam">$username</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$password</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$authtype</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method sets the username and password for authorizing the
client to a server. With the default (HTTP) transport, this
information is used for HTTP Basic authorization. Note that username
and password can also be set using the class constructor. With HTTP
1.1 and HTTPS transport, NTLM and Digest authentication protocols
are also supported. To enable them use the constants
<code class="constant">CURLAUTH_DIGEST</code> and
<code class="constant">CURLAUTH_NTLM</code> as values for the authtype
parameter.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935364"></a>setCurlOptions</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setCurlOptions</b>(</code></td><td>array<var class="pdparam">$options</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method allows to directly set any desired
option to manipulate the usage of the cURL client (when in cURL
mode). It can be used eg. to explicitly bind to an outgoing ip
address when the server is multihomed</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935395"></a>setDebug</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setDebug</b>(</code></td><td>int<var class="pdparam">$debugLvl</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p><em class="parameter"><code>debugLvl</code></em> is either <code class="literal">0,
1</code> or 2 depending on whether you require the client to
print debugging information to the browser. The default is not to
output this information (0).</p><p>The debugging information at level 1includes the raw data
returned from the XML-RPC server it was querying (including bot HTTP
headers and the full XML payload), and the PHP value the client
attempts to create to represent the value returned by the server. At
level2, the complete payload of the xmlrpc request is also printed,
before being sent t the server.</p><p>This option can be very useful when debugging servers as it
allows you to see exactly what the client sends and the server
returns.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935441"></a>setKey</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setKey</b>(</code></td><td>int<var class="pdparam">$key</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$keypass</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method sets the optional certificate key and passphrase
used in SSL-enabled communication with a remote server (when the
<em class="parameter"><code>transport</code></em> is set to 'https' in the client's
construction or in the send method).</p><p>This requires the "curl" extension to be compiled into your
installation of PHP. For more details see the man page for the
<code class="function">curl_setopt</code> function.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935491"></a>setProxy</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setProxy</b>(</code></td><td>string<var class="pdparam">$proxyhost</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$proxyport</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$proxyusername</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$proxypassword</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$authtype</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method enables calling servers via an HTTP proxy. The
<em class="parameter"><code>proxyusername</code></em>,<em class="parameter"><code>
proxypassword</code></em> and <em class="parameter"><code>authtype</code></em>
parameters are optional. <em class="parameter"><code>Authtype</code></em> defaults to
<code class="constant">CURLAUTH_BASIC</code> (Basic authentication protocol);
the only other valid value is the constant
<code class="constant">CURLAUTH_NTLM</code>, and has effect only when the
client uses the HTTP 1.1 protocol.</p><p>NB: CURL versions before 7.11.10 cannot use a proxy to
communicate with https servers.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935642"></a>setRequestCompression</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setRequestCompression</b>(</code></td><td>string<var class="pdparam">$compressionmethod</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method defines whether the xml payload forming the
request body will be sent to the server in compressed format, as per
the HTTP specification. This is particularly useful for large
request parameters and over slow network connections. Allowed values
for <em class="parameter"><code>compressionmethod</code></em> are: 'gzip', 'deflate',
'any' or null (with any meaning either gzip or deflate). Note that
there is no automatic fallback mechanism in place for errors due to
servers not supporting receiving compressed request bodies, so make
sure that the particular server you are querying does accept
compressed requests before turning it on.</p><p>This requires the "zlib" extension to be enabled in your php
install.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935682"></a>setSSLVerifyHost</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setSSLVerifyHost</b>(</code></td><td>int<var class="pdparam">$i</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method defines whether connections made to XML-RPC
backends via HTTPS should verify the remote host's SSL certificate's
common name (CN). By default, only the existence of a CN is checked.
<em class="parameter"><code><em class="parameter"><code>$i</code></em></code></em> should be an
integer value; 0 to not check the CN at all, 1 to merely check for
its existence, and 2 to check that the CN on the certificate matches
the hostname that is being connected to.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935719"></a>setSSLVerifyPeer</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">setSSLVerifyPeer</b>(</code></td><td>bool<var class="pdparam">$i</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method defines whether connections made to XML-RPC
backends via HTTPS should verify the remote host's SSL certificate,
and cause the connection to fail if the cert verification fails.
<em class="parameter"><code><em class="parameter"><code>$i</code></em></code></em> should be a boolean
value. Default value: <code class="constant">TRUE</code>. To specify custom
SSL certificates to validate the server with, use the
<code class="methodname">setCaCertificate</code> method.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935763"></a>setUserAgent</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">Useragent</b>(</code></td><td>string<var class="pdparam">$useragent</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>This method sets a custom user-agent that will be
used by the client in the http headers sent with the request. The
default value is built using the library name and version
constants.</p></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id935796"></a>Variables</h3></div></div></div><p>NB: direct manipulation of these variables is only recommended
for advanced users.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935805"></a>no_multicall</h4></div></div></div><p>This member variable determines whether the multicall() method
will try to take advantage of the system.multicall xmlrpc method to
dispatch to the server an array of requests in a single http
roundtrip or simply execute many consecutive http calls. Defaults to
FALSE, but it will be enabled automatically on the first failure of
execution of system.multicall.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935816"></a>request_charset_encoding</h4></div></div></div><p>This is the charset encoding that will be used for serializing
request sent by the client.</p><p>If defaults to NULL, which means using US-ASCII and encoding
all characters outside of the ASCII range using their xml character
entity representation (this has the benefit that line end characters
will not be mangled in the transfer, a CR-LF will be preserved as
well as a singe LF).</p><p>Valid values are 'US-ASCII', 'UTF-8' and 'ISO-8859-1'</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="return-type"></a>return_type</h4></div></div></div><p>This member variable determines whether the value returned
inside an xmlrpcresp object as results of calls to the send() and
multicall() methods will be an xmlrpcval object, a plain php value
or a raw xml string. Allowed values are 'xmlrpcvals' (the default),
'phpvals' and 'xml'. To allow the user to differentiate between a
correct and a faulty response, fault responses will be returned as
xmlrpcresp objects in any case. Note that the 'phpvals' setting will
yield faster execution times, but some of the information from the
original response will be lost. It will be e.g. impossible to tell
whether a particular php string value was sent by the server as an
xmlrpc string or base64 value.</p><p>Example usage:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">"phpxmlrpc.sourceforge.net/server"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">return_type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'phpvals'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$message&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span style="color: #DD0000">"examples.getStateName"</span><span style="color: #007700">,&nbsp;array(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #0000BB">23</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"int"</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB">$resp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">$message</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())&nbsp;echo&nbsp;</span><span style="color: #DD0000">'KO.&nbsp;Error:&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultString</span><span style="color: #007700">();&nbsp;else&nbsp;echo&nbsp;</span><span style="color: #DD0000">'OK:&nbsp;got&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">();</span>
</span>
</code></pre><p>For more details about usage of the 'xml' value, see Appendix
A.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">xmlrpcmsg </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> xmlrpcresp</td></tr></table></div></body></html>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>xmlrpcresp</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link rel="prev" href="ch07s03.html" title="xmlrpc_client" /><link rel="next" href="ch07s05.html" title="xmlrpc_server" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">xmlrpcresp</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s03.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Class documentation</th><td width="20%" align="right"> <a accesskey="n" href="ch07s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xmlrpcresp"></a>xmlrpcresp</h2></div></div></div><p>This class is used to contain responses to XML-RPC requests. A
server method handler will construct an
<code class="classname">xmlrpcresp</code> and pass it as a return value. This
same value will be returned by the result of an invocation of the
<code class="function">send</code> method of the
<code class="classname">xmlrpc_client</code> class.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id935884"></a>Creation</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcrespnew
<b class="fsfunc">xmlrpcresp</b>(</code></td><td>xmlrpcval<var class="pdparam">$xmlrpcval</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcrespnew
<b class="fsfunc">xmlrpcresp</b>(</code></td><td><var class="pdparam">0</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$errcode</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$err_string</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>The first syntax is used when execution has happened without
difficulty: <em class="parameter"><code>$xmlrpcval</code></em> is an
<code class="classname">xmlrpcval</code> value with the result of the method
execution contained in it. Alternatively it can be a string containing
the xml serialization of the single xml-rpc value result of method
execution.</p><p>The second type of constructor is used in case of failure.
<em class="parameter"><code>errcode</code></em> and <em class="parameter"><code>err_string</code></em>
are used to provide indication of what has gone wrong. See <a class="xref" href="ch07s05.html" title="xmlrpc_server">xmlrpc_server</a> for more information on passing error
codes.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id935971"></a>Methods</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id935977"></a>faultCode</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">faultCode</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the integer fault code return from the XML-RPC
response. A zero value indicates success, any other value indicates
a failure response.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936004"></a>faultString</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">faultString</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns the human readable explanation of the fault indicated
by <code class="function">$resp-&gt;faultCode</code>().</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936036"></a>value</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">value</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns an <code class="classname">xmlrpcval</code> object containing
the return value sent by the server. If the response's
<code class="function">faultCode</code> is non-zero then the value returned
by this method should not be used (it may not even be an
object).</p><p>Note: if the xmlrpcresp instance in question has been created
by an <code class="classname">xmlrpc_client</code> object whose
<code class="varname">return_type</code> was set to 'phpvals', then a plain
php value will be returned instead of an
<code class="classname">xmlrpcval</code> object. If the
<code class="varname">return_type</code> was set to 'xml', an xml string will
be returned (see the return_type member var above for more
details).</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936088"></a>serialize</h4></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">serialize</b>(</code></td><td><code>void)</code>;</td><td> </td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns an XML string representation of the response (xml
prologue not included).</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">xmlrpc_client </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> xmlrpc_server</td></tr></table></div></body></html>

View File

@@ -1,202 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>xmlrpc_server</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch07.html" title="Chapter 7. Class documentation" /><link rel="prev" href="ch07s04.html" title="xmlrpcresp" /><link rel="next" href="ch08.html" title="Chapter 8. Global variables" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">xmlrpc_server</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s04.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Class documentation</th><td width="20%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xmlrpc-server"></a>xmlrpc_server</h2></div></div></div><p>The implementation of this class has been kept as simple to use as
possible. The constructor for the server basically does all the work.
Here's a minimal example:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">&nbsp;&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">foo&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmlrpcmsg</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcresp</span><span style="color: #007700">(</span><span style="color: #0000BB">$some_xmlrpc_val</span><span style="color: #007700">);<br />&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;class&nbsp;</span><span style="color: #0000BB">bar&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;</span><span style="color: #0000BB">foobar</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmlrpcmsg</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcresp</span><span style="color: #007700">(</span><span style="color: #0000BB">$some_xmlrpc_val</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"examples.myFunc1"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">"function"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"examples.myFunc2"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">"function"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"bar::foobar"</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;));</span>
</span>
</code></pre><p>This performs everything you need to do with a server. The single
constructor argument is an associative array from xmlrpc method names to
php function names. The incoming request is parsed and dispatched to the
relevant php function, which is responsible for returning a
<code class="classname">xmlrpcresp</code> object, that will be serialized back
to the caller.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id936390"></a>Method handler functions</h3></div></div></div><p>Both php functions and class methods can be registered as xmlrpc
method handlers.</p><p>The synopsis of a method handler function is:</p><pre class="synopsis">xmlrpcresp $resp = function (xmlrpcmsg $msg)</pre><p>No text should be echoed 'to screen' by the handler function, or
it will break the xml response sent back to the client. This applies
also to error and warning messages that PHP prints to screen unless
the appropriate parameters have been set in the php.in file. Another
way to prevent echoing of errors inside the response and facilitate
debugging is to use the server SetDebug method with debug level 3 (see
...). Exceptions thrown duting execution of handler functions are
caught by default and a XML-RPC error reponse is generated instead.
This behaviour can be finetuned by usage of the
<code class="varname">exception_handling</code> member variable (see
...).</p><p>Note that if you implement a method with a name prefixed by
<code class="code">system.</code> the handler function will be invoked by the
server with two parameters, the first being the server itself and the
second being the <code class="classname">xmlrpcmsg</code> object.</p><p>The same php function can be registered as handler of multiple
xmlrpc methods.</p><p>Here is a more detailed example of what the handler function
<code class="function">foo</code> may do:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">&nbsp;&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">foo&nbsp;</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmlrpcmsg</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">$xmlrpcerruser</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;import&nbsp;user&nbsp;errcode&nbsp;base&nbsp;value<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$meth&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmlrpcmsg</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">method</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//&nbsp;retrieve&nbsp;method&nbsp;name<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$par&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmlrpcmsg</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getParam</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;retrieve&nbsp;value&nbsp;of&nbsp;first&nbsp;parameter&nbsp;-&nbsp;assumes&nbsp;at&nbsp;least&nbsp;one&nbsp;param&nbsp;received<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$par</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">scalarval</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//&nbsp;decode&nbsp;value&nbsp;of&nbsp;first&nbsp;parameter&nbsp;-&nbsp;assumes&nbsp;it&nbsp;is&nbsp;a&nbsp;scalar&nbsp;value<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">...<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$err</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;this&nbsp;is&nbsp;an&nbsp;error&nbsp;condition<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcresp</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcerruser</span><span style="color: #007700">+</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #FF8000">//&nbsp;user&nbsp;error&nbsp;1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"There's&nbsp;a&nbsp;problem,&nbsp;Captain"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;this&nbsp;is&nbsp;a&nbsp;successful&nbsp;value&nbsp;being&nbsp;returned<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">return&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcresp</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">"All's&nbsp;fine!"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"string"</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}</span>
</span>
</code></pre><p>See <code class="filename">server.php</code> in this distribution for
more examples of how to do this.</p><p>Since release 2.0RC3 there is a new, even simpler way of
registering php functions with the server. See section 5.7
below</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id936453"></a>The dispatch map</h3></div></div></div><p>The first argument to the <code class="function">xmlrpc_server</code>
constructor is an array, called the <span class="emphasis"><em>dispatch map</em></span>.
In this array is the information the server needs to service the
XML-RPC methods you define.</p><p>The dispatch map takes the form of an associative array of
associative arrays: the outer array has one entry for each method, the
key being the method name. The corresponding value is another
associative array, which can have the following members:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="function"><code class="literal">function</code></code> - this
entry is mandatory. It must be either a name of a function in the
global scope which services the XML-RPC method, or an array
containing an instance of an object and a static method name (for
static class methods the 'class::method' syntax is also
supported).</p></li><li><p><code class="function"><code class="literal">signature</code></code> - this
entry is an array containing the possible signatures (see <a class="xref" href="ch07s05.html#signatures" title="Method signatures">Signatures</a>) for the method. If this entry is present
then the server will check that the correct number and type of
parameters have been sent for this method before dispatching
it.</p></li><li><p><code class="function"><code class="literal">docstring</code></code> - this
entry is a string containing documentation for the method. The
documentation may contain HTML markup.</p></li><li><p><code class="literal">signature_docs</code> - this entry can be used
to provide documentation for the single parameters. It must match
in structure the 'signature' member. By default, only the
<code class="classname">documenting_xmlrpc_server</code> class in the
extras package will take advantage of this, since the
"system.methodHelp" protocol does not support documenting method
parameters individually.</p></li><li><p><code class="literal">parameters_type</code> - this entry can be used
when the server is working in 'xmlrpcvals' mode (see ...) to
define one or more entries in the dispatch map as being functions
that follow the 'phpvals' calling convention. The only useful
value is currently the string <code class="literal">phpvals</code>.</p></li></ul></div><p>Look at the <code class="filename">server.php</code> example in the
distribution to see what a dispatch map looks like.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="signatures"></a>Method signatures</h3></div></div></div><p>A signature is a description of a method's return type and its
parameter types. A method may have more than one signature.</p><p>Within a server's dispatch map, each method has an array of
possible signatures. Each signature is an array of types. The first
entry is the return type. For instance, the method </p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;string&nbsp;examples</span><span style="color: #007700">.</span><span style="color: #0000BB">getStateName</span><span style="color: #007700">(int)</span>
</span>
</code></pre><p> has the signature </p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">array(</span><span style="color: #0000BB">$xmlrpcString</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcInt</span><span style="color: #007700">)</span>
</span>
</code></pre><p> and, assuming that it is the only possible signature for the
method, it might be used like this in server creation: </p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$findstate_sig&nbsp;</span><span style="color: #007700">=&nbsp;array(array(</span><span style="color: #0000BB">$xmlrpcString</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcInt</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">$findstate_doc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'When&nbsp;passed&nbsp;an&nbsp;integer&nbsp;between&nbsp;1&nbsp;and&nbsp;51&nbsp;returns&nbsp;the<br />name&nbsp;of&nbsp;a&nbsp;US&nbsp;state,&nbsp;where&nbsp;the&nbsp;integer&nbsp;is&nbsp;the&nbsp;index&nbsp;of&nbsp;that&nbsp;state&nbsp;name<br />in&nbsp;an&nbsp;alphabetic&nbsp;order.'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">(&nbsp;array(<br />&nbsp;&nbsp;</span><span style="color: #DD0000">"examples.getStateName"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"function"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"findstate"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"signature"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$findstate_sig</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"docstring"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$findstate_doc<br />&nbsp;&nbsp;</span><span style="color: #007700">)));</span>
</span>
</code></pre><p>Note that method signatures do not allow to check nested
parameters, e.g. the number, names and types of the members of a
struct param cannot be validated.</p><p>If a method that you want to expose has a definite number of
parameters, but each of those parameters could reasonably be of
multiple types, the array of acceptable signatures will easily grow
into a combinatorial explosion. To avoid such a situation, the lib
defines the global var <code class="varname">$xmlrpcValue</code>, which can be
used in method signatures as a placeholder for 'any xmlrpc
type':</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$echoback_sig&nbsp;</span><span style="color: #007700">=&nbsp;array(array(</span><span style="color: #0000BB">$xmlrpcValue</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcValue</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">$findstate_doc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Echoes&nbsp;back&nbsp;to&nbsp;the&nbsp;client&nbsp;the&nbsp;received&nbsp;value,&nbsp;regardless&nbsp;of&nbsp;its&nbsp;type'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">(&nbsp;array(<br />&nbsp;&nbsp;</span><span style="color: #DD0000">"echoBack"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"function"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"echoback"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"signature"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$echoback_sig</span><span style="color: #007700">,&nbsp;</span><span style="color: #FF8000">//&nbsp;this&nbsp;sig&nbsp;guarantees&nbsp;that&nbsp;the&nbsp;method&nbsp;handler&nbsp;will&nbsp;be&nbsp;called&nbsp;with&nbsp;one&nbsp;and&nbsp;only&nbsp;one&nbsp;parameter<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"docstring"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$echoback_doc<br />&nbsp;&nbsp;</span><span style="color: #007700">)));</span>
</span>
</code></pre><p>Methods <code class="methodname">system.listMethods</code>,
<code class="methodname">system.methodHelp</code>,
<code class="methodname">system.methodSignature</code> and
<code class="methodname">system.multicall</code> are already defined by the
server, and should not be reimplemented (see Reserved Methods
below).</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id936613"></a>Delaying the server response</h3></div></div></div><p>You may want to construct the server, but for some reason not
fulfill the request immediately (security verification, for instance).
If you omit to pass to the constructor the dispatch map or pass it a
second argument of <code class="literal">0</code> this will have the desired
effect. You can then use the <code class="function">service()</code> method of
the server class to service the request. For example:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">(</span><span style="color: #0000BB">$myDispMap</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;second&nbsp;parameter&nbsp;=&nbsp;0&nbsp;prevents&nbsp;automatic&nbsp;servicing&nbsp;of&nbsp;request<br /><br />//&nbsp;...&nbsp;some&nbsp;code&nbsp;that&nbsp;does&nbsp;other&nbsp;stuff&nbsp;here<br /><br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">service</span><span style="color: #007700">();</span>
</span>
</code></pre><p>Note that the <code class="methodname">service</code> method will print
the complete result payload to screen and send appropriate HTTP
headers back to the client, but also return the response object. This
permits further manipulation of the response, possibly in combination
with output buffering.</p><p>To prevent the server from sending HTTP headers back to the
client, you can pass a second parameter with a value of
<code class="literal">TRUE</code> to the <code class="methodname">service</code>
method. In this case, the response payload will be returned instead of
the response object.</p><p>Xmlrpc requests retrieved by other means than HTTP POST bodies
can also be processed. For example:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//&nbsp;not&nbsp;passing&nbsp;a&nbsp;dispatch&nbsp;map&nbsp;prevents&nbsp;automatic&nbsp;servicing&nbsp;of&nbsp;request<br /><br />//&nbsp;...&nbsp;some&nbsp;code&nbsp;that&nbsp;does&nbsp;other&nbsp;stuff&nbsp;here,&nbsp;including&nbsp;setting&nbsp;dispatch&nbsp;map&nbsp;into&nbsp;server&nbsp;object<br /><br /></span><span style="color: #0000BB">$resp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">service</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmlrpc_request_body</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;parse&nbsp;a&nbsp;variable&nbsp;instead&nbsp;of&nbsp;POST&nbsp;body,&nbsp;retrieve&nbsp;response&nbsp;payload<br /><br />//&nbsp;...&nbsp;some&nbsp;code&nbsp;that&nbsp;does&nbsp;other&nbsp;stuff&nbsp;with&nbsp;xml&nbsp;response&nbsp;$resp&nbsp;here</span>
</span>
</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id936662"></a>Modifying the server behaviour</h3></div></div></div><p>A couple of methods / class variables are available to modify
the behaviour of the server. The only way to take advantage of their
existence is by usage of a delayed server response (see above)</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936672"></a>setDebug()</h4></div></div></div><p>This function controls weather the server is going to echo
debugging messages back to the client as comments in response body.
Valid values: 0,1,2,3, with 1 being the default. At level 0, no
debug info is returned to the client. At level 2, the complete
client request is added to the response, as part of the xml
comments. At level 3, a new PHP error handler is set when executing
user functions exposed as server methods, and all non-fatal errors
are trapped and added as comments into the response.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936682"></a>allow_system_funcs</h4></div></div></div><p>Default_value: TRUE. When set to FALSE, disables support for
<code class="methodname">System.xxx</code> functions in the server. It
might be useful e.g. if you do not wish the server to respond to
requests to <code class="methodname">System.ListMethods</code>.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936700"></a>compress_response</h4></div></div></div><p>When set to TRUE, enables the server to take advantage of HTTP
compression, otherwise disables it. Responses will be transparently
compressed, but only when an xmlrpc-client declares its support for
compression in the HTTP headers of the request.</p><p>Note that the ZLIB php extension must be installed for this to
work. If it is, <code class="varname">compress_response</code> will default to
TRUE.</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936718"></a>exception_handling</h4></div></div></div><p>This variable controls the behaviour of the server when an
exception is thrown by a method handler php function. Valid values:
0,1,2, with 0 being the default. At level 0, the server catches the
exception and return an 'internal error' xmlrpc response; at 1 it
catches the exceptions and return an xmlrpc response with the error
code and error message corresponding to the exception that was
thron; at 2 = the exception is floated to the upper layers in the
code</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id936729"></a>response_charset_encoding</h4></div></div></div><p>Charset encoding to be used for response (only affects string
values).</p><p>If it can, the server will convert the generated response from
internal_encoding to the intended one.</p><p>Valid values are: a supported xml encoding (only UTF-8 and
ISO-8859-1 at present, unless mbstring is enabled), null (leave
charset unspecified in response and convert output stream to
US_ASCII), 'default' (use xmlrpc library default as specified in
xmlrpc.inc, convert output stream if needed), or 'auto' (use
client-specified charset encoding or same as request if request
headers do not specify it (unless request is US-ASCII: then use
library default anyway).</p></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id936748"></a>Fault reporting</h3></div></div></div><p>Fault codes for your servers should start at the value indicated
by the global <code class="literal">$xmlrpcerruser</code> + 1.</p><p>Standard errors returned by the server include:</p><div class="variablelist"><dl><dt><span class="term"><code class="literal">1</code> <span>Unknown method</span></span></dt><dd><p>Returned if the server was asked to dispatch a method it
didn't know about</p></dd><dt><span class="term"><code class="literal">2</code> <span>Invalid return
payload</span></span></dt><dd><p>This error is actually generated by the client, not
server, code, but signifies that a server returned something it
couldn't understand. A more detailed error report is sometimes
added onto the end of the phrase above.</p></dd><dt><span class="term"><code class="literal">3</code> <span>Incorrect
parameters</span></span></dt><dd><p>This error is generated when the server has signature(s)
defined for a method, and the parameters passed by the client do
not match any of signatures.</p></dd><dt><span class="term"><code class="literal">4</code> <span>Can't introspect: method
unknown</span></span></dt><dd><p>This error is generated by the builtin
<code class="function">system.*</code> methods when any kind of
introspection is attempted on a method undefined by the
server.</p></dd><dt><span class="term"><code class="literal">5</code> <span>Didn't receive 200 OK from
remote server</span></span></dt><dd><p>This error is generated by the client when a remote server
doesn't return HTTP/1.1 200 OK in response to a request. A more
detailed error report is added onto the end of the phrase
above.</p></dd><dt><span class="term"><code class="literal">6</code> <span>No data received from
server</span></span></dt><dd><p>This error is generated by the client when a remote server
returns HTTP/1.1 200 OK in response to a request, but no
response body follows the HTTP headers.</p></dd><dt><span class="term"><code class="literal">7</code> <span>No SSL support compiled
in</span></span></dt><dd><p>This error is generated by the client when trying to send
a request with HTTPS and the CURL extension is not available to
PHP.</p></dd><dt><span class="term"><code class="literal">8</code> <span>CURL error</span></span></dt><dd><p>This error is generated by the client when trying to send
a request with HTTPS and the HTTPS communication fails.</p></dd><dt><span class="term"><code class="literal">9-14</code> <span>multicall
errors</span></span></dt><dd><p>These errors are generated by the server when something
fails inside a system.multicall request.</p></dd><dt><span class="term"><code class="literal">100-</code> <span>XML parse
errors</span></span></dt><dd><p>Returns 100 plus the XML parser error code for the fault
that occurred. The <code class="function">faultString</code> returned
explains where the parse error was in the incoming XML
stream.</p></dd></dl></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937308"></a>'New style' servers</h3></div></div></div><p>In the same spirit of simplification that inspired the
<code class="varname">xmlrpc_client::return_type</code> class variable, a new
class variable has been added to the server class:
<code class="varname">functions_parameters_type</code>. When set to 'phpvals',
the functions registered in the server dispatch map will be called
with plain php values as parameters, instead of a single xmlrpcmsg
instance parameter. The return value of those functions is expected to
be a plain php value, too. An example is worth a thousand
words:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">&nbsp;&nbsp;</span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">$usr_id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$out_lang</span><span style="color: #007700">=</span><span style="color: #DD0000">'en'</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">$xmlrpcerruser</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;...<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$someErrorCondition</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcresp</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcerruser</span><span style="color: #007700">+</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'DOH!'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'name'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'Joe'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'age'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">27</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'picture'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #0000BB">$picOfTheGuy</span><span style="color: #007700">),&nbsp;</span><span style="color: #DD0000">'base64'</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"examples.myFunc"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"function"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"bar::foobar"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"signature"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #0000BB">$xmlrpcString</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcInt</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array(</span><span style="color: #0000BB">$xmlrpcString</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcInt</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xmlrpcString</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;),&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">functions_parameters_type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'phpvals'</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">service</span><span style="color: #007700">();</span>
</span>
</code></pre><p>There are a few things to keep in mind when using this
simplified syntax:</p><p>to return an xmlrpc error, the method handler function must
return an instance of <code class="classname">xmlrpcresp</code>. The only
other way for the server to know when an error response should be
served to the client is to throw an exception and set the server's
<code class="varname">exception_handling</code> memeber var to 1;</p><p>to return a base64 value, the method handler function must
encode it on its own, creating an instance of an xmlrpcval
object;</p><p>the method handler function cannot determine the name of the
xmlrpc method it is serving, unlike standard handler functions that
can retrieve it from the message object;</p><p>when receiving nested parameters, the method handler function
has no way to distinguish a php string that was sent as base64 value
from one that was sent as a string value;</p><p>this has a direct consequence on the support of
system.multicall: a method whose signature contains datetime or base64
values will not be available to multicall calls;</p><p>last but not least, the direct parsing of xml to php values is
much faster than using xmlrpcvals, and allows the library to handle
much bigger messages without allocating all available server memory or
smashing PHP recursive call stack.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">xmlrpcresp </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 8. Global variables</td></tr></table></div></body></html>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 8. Global variables</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch07s05.html" title="xmlrpc_server" /><link rel="next" href="ch08s02.html" title="Variables whose value can be modified" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 8. Global variables</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch07s05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch08s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="globalvars"></a>Chapter 8. Global variables</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch08.html#id937374">"Constant" variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch08.html#id937380">$xmlrpcerruser</a></span></dt><dt><span class="sect2"><a href="ch08.html#id937400">$xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble,
$xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray,
$xmlrpcStruct, $xmlrpcValue, $xmlrpcNull</a></span></dt><dt><span class="sect2"><a href="ch08.html#id937415">$xmlrpcTypes, $xmlrpc_valid_parents, $xmlrpcerr, $xmlrpcstr,
$xmlrpcerrxml, $xmlrpc_backslash, $_xh, $xml_iso88591_Entities,
$xmlEntities, $xmlrpcs_capabilities</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch08s02.html">Variables whose value can be modified</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch08s02.html#xmlrpc-defencoding">xmlrpc_defencoding</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937475">xmlrpc_internalencoding</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937501">xmlrpcName</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937522">xmlrpcVersion</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937542">xmlrpc_null_extension</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937560">xmlrpc_null_apache_encoding</a></span></dt></dl></dd></dl></div><p>Many global variables are defined in the xmlrpc.inc file. Some of
those are meant to be used as constants (and modifying their value might
cause unpredictable behaviour), while some others can be modified in your
php scripts to alter the behaviour of the xml-rpc client and
server.</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id937374"></a>"Constant" variables</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937380"></a>$xmlrpcerruser</h3></div></div></div><p><code class="fieldsynopsis"><span class="varname">$xmlrpcerruser </span><span class="initializer">= 800</span>;</code>The minimum value for errors reported by user
implemented XML-RPC servers. Error numbers lower than that are
reserved for library usage.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937400"></a>$xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble,
$xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray,
$xmlrpcStruct, $xmlrpcValue, $xmlrpcNull</h3></div></div></div><p>For convenience the strings representing the XML-RPC types have
been encoded as global variables:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$xmlrpcI4</span><span style="color: #007700">=</span><span style="color: #DD0000">"i4"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcInt</span><span style="color: #007700">=</span><span style="color: #DD0000">"int"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcBoolean</span><span style="color: #007700">=</span><span style="color: #DD0000">"boolean"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcDouble</span><span style="color: #007700">=</span><span style="color: #DD0000">"double"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcString</span><span style="color: #007700">=</span><span style="color: #DD0000">"string"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcDateTime</span><span style="color: #007700">=</span><span style="color: #DD0000">"dateTime.iso8601"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcBase64</span><span style="color: #007700">=</span><span style="color: #DD0000">"base64"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcArray</span><span style="color: #007700">=</span><span style="color: #DD0000">"array"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcStruct</span><span style="color: #007700">=</span><span style="color: #DD0000">"struct"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcValue</span><span style="color: #007700">=</span><span style="color: #DD0000">"undefined"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$xmlrpcNull</span><span style="color: #007700">=</span><span style="color: #DD0000">"null"</span><span style="color: #007700">;</span>
</span>
</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937415"></a>$xmlrpcTypes, $xmlrpc_valid_parents, $xmlrpcerr, $xmlrpcstr,
$xmlrpcerrxml, $xmlrpc_backslash, $_xh, $xml_iso88591_Entities,
$xmlEntities, $xmlrpcs_capabilities</h3></div></div></div><p>Reserved for internal usage.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07s05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch08s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">xmlrpc_server </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Variables whose value can be modified</td></tr></table></div></body></html>

View File

@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Variables whose value can be modified</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch08.html" title="Chapter 8. Global variables" /><link rel="prev" href="ch08.html" title="Chapter 8. Global variables" /><link rel="next" href="ch09.html" title="Chapter 9. Helper functions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Variables whose value can be modified</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><th width="60%" align="center">Chapter 8. Global variables</th><td width="20%" align="right"> <a accesskey="n" href="ch09.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id937427"></a>Variables whose value can be modified</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="xmlrpc-defencoding"></a>xmlrpc_defencoding</h3></div></div></div><code class="fieldsynopsis"><span class="varname">$xmlrpc_defencoding </span><span class="initializer">= "UTF8"</span>;</code><p>This variable defines the character set encoding that will be
used by the xml-rpc client and server to decode the received messages,
when a specific charset declaration is not found (in the messages sent
non-ascii chars are always encoded using character references, so that
the produced xml is valid regardless of the charset encoding
assumed).</p><p>Allowed values: <code class="literal">"UTF8"</code>,
<code class="literal">"ISO-8859-1"</code>, <code class="literal">"ASCII".</code></p><p>Note that the appropriate RFC actually mandates that XML
received over HTTP without indication of charset encoding be treated
as US-ASCII, but many servers and clients 'in the wild' violate the
standard, and assume the default encoding is UTF-8.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937475"></a>xmlrpc_internalencoding</h3></div></div></div><p><code class="fieldsynopsis"><span class="varname">$xmlrpc_internalencoding </span><span class="initializer">= "ISO-8859-1"</span>;</code>This variable defines the character set encoding
that the library uses to transparently encode into valid XML the
xml-rpc values created by the user and to re-encode the received
xml-rpc values when it passes them to the PHP application. It only
affects xml-rpc values of string type. It is a separate value from
xmlrpc_defencoding, allowing e.g. to send/receive xml messages encoded
on-the-wire in US-ASCII and process them as UTF-8. It defaults to the
character set used internally by PHP (unless you are running an
MBString-enabled installation), so you should change it only in
special situations, if e.g. the string values exchanged in the xml-rpc
messages are directly inserted into / fetched from a database
configured to return UTF8 encoded strings to PHP. Example
usage:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">&lt;?</span><span style="color: #0000BB">php<br /><br /></span><span style="color: #007700">include(</span><span style="color: #DD0000">'xmlrpc.inc'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$xmlrpc_internalencoding&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'UTF-8'</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;this&nbsp;has&nbsp;to&nbsp;be&nbsp;set&nbsp;after&nbsp;the&nbsp;inclusion&nbsp;above<br /></span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">'κόσμε'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;This&nbsp;xmlrpc&nbsp;value&nbsp;will&nbsp;be&nbsp;correctly&nbsp;serialized&nbsp;as&nbsp;the&nbsp;greek&nbsp;word&nbsp;'kosme'</span>
</span>
</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937501"></a>xmlrpcName</h3></div></div></div><p><code class="fieldsynopsis"><span class="varname">$xmlrpcName </span><span class="initializer">= "XML-RPC for PHP"</span>;</code>The string representation of the name of the XML-RPC
for PHP library. It is used by the client for building the User-Agent
HTTP header that is sent with every request to the server. You can
change its value if you need to customize the User-Agent
string.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937522"></a>xmlrpcVersion</h3></div></div></div><p><code class="fieldsynopsis"><span class="varname">$xmlrpcVersion </span><span class="initializer">= "2.2"</span>;</code>The string representation of the version number of
the XML-RPC for PHP library in use. It is used by the client for
building the User-Agent HTTP header that is sent with every request to
the server. You can change its value if you need to customize the
User-Agent string.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937542"></a>xmlrpc_null_extension</h3></div></div></div><p>When set to <code class="constant">TRUE</code>, the lib will enable
support for the &lt;NIL/&gt; (and &lt;EX:NIL/&gt;) xmlrpc value, as
per the extension to the standard proposed here. This means that
&lt;NIL/&gt; and &lt;EX:NIL/&gt; tags received will be parsed as valid
xmlrpc, and the corresponding xmlrpcvals will return "null" for
<code class="methodname">scalarTyp()</code>.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id937560"></a>xmlrpc_null_apache_encoding</h3></div></div></div><p>When set to <code class="literal">TRUE</code>, php NULL values encoded
into <code class="classname">xmlrpcval</code> objects get serialized using the
<code class="literal">&lt;EX:NIL/&gt;</code> tag instead of
<code class="literal">&lt;NIL/&gt;</code>. Please note that both forms are
always accepted as input regardless of the value of this
variable.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch08.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. Global variables </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 9. Helper functions</td></tr></table></div></body></html>

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 9. Helper functions</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch08s02.html" title="Variables whose value can be modified" /><link rel="next" href="ch09s02.html" title="Easy use with nested PHP values" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. Helper functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08s02.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch09s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="helpers"></a>Chapter 9. Helper functions</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch09.html#id937598">Date functions</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09.html#iso8601encode">iso8601_encode</a></span></dt><dt><span class="sect2"><a href="ch09.html#iso8601decode">iso8601_decode</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s02.html">Easy use with nested PHP values</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s02.html#phpxmlrpcdecode">php_xmlrpc_decode</a></span></dt><dt><span class="sect2"><a href="ch09s02.html#phpxmlrpcencode">php_xmlrpc_encode</a></span></dt><dt><span class="sect2"><a href="ch09s02.html#id938212">php_xmlrpc_decode_xml</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s03.html">Automatic conversion of php functions into xmlrpc methods (and
vice versa)</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s03.html#id938280">wrap_xmlrpc_method</a></span></dt><dt><span class="sect2"><a href="ch09s03.html#wrap_php_function">wrap_php_function</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s04.html">Functions removed from the library</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s04.html#xmlrpcdecode">xmlrpc_decode</a></span></dt><dt><span class="sect2"><a href="ch09s04.html#xmlrpcencode">xmlrpc_encode</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s05.html">Debugging aids</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s05.html#id938694">xmlrpc_debugmsg</a></span></dt></dl></dd></dl></div><p>XML-RPC for PHP contains some helper functions which you can use to
make processing of XML-RPC requests easier.</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id937598"></a>Date functions</h2></div></div></div><p>The XML-RPC specification has this to say on dates:</p><div class="blockquote"><blockquote class="blockquote"><p><a id="wrap_xmlrpc_method"></a>Don't assume a timezone. It should be
specified by the server in its documentation what assumptions it makes
about timezones.</p></blockquote></div><p>Unfortunately, this means that date processing isn't
straightforward. Although XML-RPC uses ISO 8601 format dates, it doesn't
use the timezone specifier.</p><p>We strongly recommend that in every case where you pass dates in
XML-RPC calls, you use UTC (GMT) as your timezone. Most computer
languages include routines for handling GMT times natively, and you
won't have to translate between timezones.</p><p>For more information about dates, see <a class="ulink" href="http://www.uic.edu/year2000/datefmt.html" target="_top">ISO 8601: The Right
Format for Dates</a>, which has a handy link to a PDF of the ISO
8601 specification. Note that XML-RPC uses exactly one of the available
representations: CCYYMMDDTHH:MM:SS.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="iso8601encode"></a>iso8601_encode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">iso8601_encode</b>(</code></td><td>string<var class="pdparam">$time_t</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$utc</var>0<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns an ISO 8601 formatted date generated from the UNIX
timestamp <em class="parameter"><code>$time_t</code></em>, as returned by the PHP
function <code class="function">time()</code>.</p><p>The argument <em class="parameter"><code>$utc</code></em> can be omitted, in
which case it defaults to <code class="literal">0</code>. If it is set to
<code class="literal">1</code>, then the function corrects the time passed in
for UTC. Example: if you're in the GMT-6:00 timezone and set
<em class="parameter"><code>$utc</code></em>, you will receive a date representation
six hours ahead of your local time.</p><p>The included demo program <code class="filename">vardemo.php</code>
includes a demonstration of this function.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="iso8601decode"></a>iso8601_decode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">int<b class="fsfunc">iso8601_decode</b>(</code></td><td>string<var class="pdparam">$isoString</var>, </td></tr><tr><td> </td><td>int<var class="pdparam">$utc</var>0<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a UNIX timestamp from an ISO 8601 encoded time and date
string passed in. If <em class="parameter"><code>$utc</code></em> is
<code class="literal">1</code> then <em class="parameter"><code>$isoString</code></em> is assumed
to be in the UTC timezone, and thus the result is also UTC: otherwise,
the timezone is assumed to be your local timezone and you receive a
local timestamp.</p></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08s02.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch09s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Variables whose value can be modified </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Easy use with nested PHP values</td></tr></table></div></body></html>

View File

@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Easy use with nested PHP values</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch09.html" title="Chapter 9. Helper functions" /><link rel="prev" href="ch09.html" title="Chapter 9. Helper functions" /><link rel="next" href="ch09s03.html" title="Automatic conversion of php functions into xmlrpc methods (and vice versa)" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Easy use with nested PHP values</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Helper functions</th><td width="20%" align="right"> <a accesskey="n" href="ch09s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="arrayuse"></a>Easy use with nested PHP values</h2></div></div></div><p>Dan Libby was kind enough to contribute two helper functions that
make it easier to translate to and from PHP values. This makes it easier
to deal with complex structures. At the moment support is limited to
<span class="type">int</span>, <span class="type">double</span>, <span class="type">string</span>,
<span class="type">array</span>, <span class="type">datetime</span> and <span class="type">struct</span>
datatypes; note also that all PHP arrays are encoded as structs, except
arrays whose keys are integer numbers starting with 0 and incremented by
1.</p><p>These functions reside in <code class="filename">xmlrpc.inc</code>.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="phpxmlrpcdecode"></a>php_xmlrpc_decode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">mixed<b class="fsfunc">php_xmlrpc_decode</b>(</code></td><td>xmlrpcval<var class="pdparam">$xmlrpc_val</var>, </td></tr><tr><td> </td><td>array<var class="pdparam">$options</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">array<b class="fsfunc">php_xmlrpc_decode</b>(</code></td><td>xmlrpcmsg<var class="pdparam">$xmlrpcmsg_val</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$options</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns a native PHP value corresponding to the values found in
the <span class="type">xmlrpcval</span> <em class="parameter"><code>$xmlrpc_val</code></em>,
translated into PHP types. Base-64 and datetime values are
automatically decoded to strings.</p><p>In the second form, returns an array containing the parameters
of the given
<em class="parameter"><code><code class="classname">xmlrpcmsg</code>_val</code></em>, decoded
to php types.</p><p>The <em class="parameter"><code>options</code></em> parameter is optional. If
specified, it must consist of an array of options to be enabled in the
decoding process. At the moment the only valid option are
<span class="symbol">decode_php_objs</span> and
<code class="literal">dates_as_objects</code>. When the first is set, php
objects that have been converted to xml-rpc structs using the
<code class="function">php_xmlrpc_encode</code> function and a corresponding
encoding option will be converted back into object values instead of
arrays (provided that the class definition is available at
reconstruction time). When the second is set, XML-RPC datetime values
will be converted into native <code class="classname">dateTime</code> objects
instead of strings.</p><p><span class="emphasis"><em><span class="emphasis"><em>WARNING</em></span>:</em></span> please take
extreme care before enabling the <span class="symbol">decode_php_objs</span>
option: when php objects are rebuilt from the received xml, their
constructor function will be silently invoked. This means that you are
allowing the remote end to trigger execution of uncontrolled PHP code
on your server, opening the door to code injection exploits. Only
enable this option when you have complete trust of the remote
server/client.</p><p>Example:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;wrapper&nbsp;to&nbsp;expose&nbsp;an&nbsp;existing&nbsp;php&nbsp;function&nbsp;as&nbsp;xmlrpc&nbsp;method&nbsp;handler<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">foo_wrapper</span><span style="color: #007700">(</span><span style="color: #0000BB">$m</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$params&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">php_xmlrpc_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$m</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$retval&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">call_user_func_array</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$params</span><span style="color: #007700">);<br />&nbsp;&nbsp;return&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcresp</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #0000BB">$retval</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//&nbsp;foo&nbsp;return&nbsp;value&nbsp;will&nbsp;be&nbsp;serialized&nbsp;as&nbsp;string<br /></span><span style="color: #007700">}<br /><br /></span><span style="color: #0000BB">$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">(array(<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"examples.myFunc1"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"function"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"foo_wrapper"</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"signatures"&nbsp;</span><span style="color: #007700">=&gt;&nbsp;...<br />&nbsp;&nbsp;)));</span>
</span>
</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="phpxmlrpcencode"></a>php_xmlrpc_encode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">php_xmlrpc_encode</b>(</code></td><td>mixed<var class="pdparam">$phpval</var>, </td></tr><tr><td> </td><td>array<var class="pdparam">$options</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Returns an <span class="type">xmlrpcval</span> object populated with the PHP
values in <em class="parameter"><code>$phpval</code></em>. Works recursively on arrays
and objects, encoding numerically indexed php arrays into array-type
xmlrpcval objects and non numerically indexed php arrays into
struct-type xmlrpcval objects. Php objects are encoded into
struct-type xmlrpcvals, excepted for php values that are already
instances of the xmlrpcval class or descendants thereof, which will
not be further encoded. Note that there's no support for encoding php
values into base-64 values. Encoding of date-times is optionally
carried on on php strings with the correct format.</p><p>The <em class="parameter"><code>options</code></em> parameter is optional. If
specified, it must consist of an array of options to be enabled in the
encoding process. At the moment the only valid options are
<span class="symbol">encode_php_objs</span>, <code class="literal">null_extension</code>
and <span class="symbol">auto_dates</span>.</p><p>The first will enable the creation of 'particular' xmlrpcval
objects out of php objects, that add a "php_class" xml attribute to
their serialized representation. This attribute allows the function
php_xmlrpc_decode to rebuild the native php objects (provided that the
same class definition exists on both sides of the communication). The
second allows to encode php <code class="literal">NULL</code> values to the
<code class="literal">&lt;NIL/&gt;</code> (or
<code class="literal">&lt;EX:NIL/&gt;</code>, see ...) tag. The last encodes any
string that matches the ISO8601 format into an XML-RPC
datetime.</p><p>Example:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #FF8000">//&nbsp;the&nbsp;easy&nbsp;way&nbsp;to&nbsp;build&nbsp;a&nbsp;complex&nbsp;xml-rpc&nbsp;struct,&nbsp;showing&nbsp;nested&nbsp;base64&nbsp;value&nbsp;and&nbsp;datetime&nbsp;values<br /></span><span style="color: #0000BB">$val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">php_xmlrpc_encode</span><span style="color: #007700">(array(<br />&nbsp;&nbsp;</span><span style="color: #DD0000">'first&nbsp;struct_element:&nbsp;an&nbsp;int'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">666</span><span style="color: #007700">,<br />&nbsp;&nbsp;</span><span style="color: #DD0000">'second:&nbsp;an&nbsp;array'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array&nbsp;(</span><span style="color: #DD0000">'apple'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'orange'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'banana'</span><span style="color: #007700">),<br />&nbsp;&nbsp;</span><span style="color: #DD0000">'third:&nbsp;a&nbsp;base64&nbsp;element'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">'hello&nbsp;world'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'base64'</span><span style="color: #007700">),<br />&nbsp;&nbsp;</span><span style="color: #DD0000">'fourth:&nbsp;a&nbsp;datetime'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'20060107T01:53:00'<br />&nbsp;&nbsp;</span><span style="color: #007700">),&nbsp;array(</span><span style="color: #DD0000">'auto_dates'</span><span style="color: #007700">));</span>
</span>
</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id938212"></a>php_xmlrpc_decode_xml</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval | xmlrpcresp |
xmlrpcmsg<b class="fsfunc">php_xmlrpc_decode_xml</b>(</code></td><td>string<var class="pdparam">$xml</var>, </td></tr><tr><td> </td><td>array<var class="pdparam">$options</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Decodes the xml representation of either an xmlrpc request,
response or single value, returning the corresponding php-xmlrpc
object, or <code class="literal">FALSE</code> in case of an error.</p><p>The <em class="parameter"><code>options</code></em> parameter is optional. If
specified, it must consist of an array of options to be enabled in the
decoding process. At the moment, no option is supported.</p><p>Example:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$text&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'&lt;value&gt;&lt;array&gt;&lt;data&gt;&lt;value&gt;Hello&nbsp;world&lt;/value&gt;&lt;/data&gt;&lt;/array&gt;&lt;/value&gt;'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">php_xmlrpc_decode_xml</span><span style="color: #007700">(</span><span style="color: #0000BB">$text</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$val</span><span style="color: #007700">)&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Found&nbsp;a&nbsp;value&nbsp;of&nbsp;type&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$val</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">kindOf</span><span style="color: #007700">();&nbsp;else&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Found&nbsp;invalid&nbsp;xml'</span><span style="color: #007700">;</span>
</span>
</code></pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch09s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 9. Helper functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Automatic conversion of php functions into xmlrpc methods (and
vice versa)</td></tr></table></div></body></html>

View File

@@ -1,103 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Automatic conversion of php functions into xmlrpc methods (and vice versa)</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch09.html" title="Chapter 9. Helper functions" /><link rel="prev" href="ch09s02.html" title="Easy use with nested PHP values" /><link rel="next" href="ch09s04.html" title="Functions removed from the library" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Automatic conversion of php functions into xmlrpc methods (and
vice versa)</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09s02.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Helper functions</th><td width="20%" align="right"> <a accesskey="n" href="ch09s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938271"></a>Automatic conversion of php functions into xmlrpc methods (and
vice versa)</h2></div></div></div><p>For the extremely lazy coder, helper functions have been added
that allow to convert a php function into an xmlrpc method, and a
remotely exposed xmlrpc method into a local php function - or a set of
methods into a php class. Note that these comes with many caveat.</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id938280"></a>wrap_xmlrpc_method</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">wrap_xmlrpc_method</b>(</code></td><td>$client, </td></tr><tr><td> </td><td>$methodname, </td></tr><tr><td> </td><td>$extra_options<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">string<b class="fsfunc">wrap_xmlrpc_method</b>(</code></td><td>$client, </td></tr><tr><td> </td><td>$methodname, </td></tr><tr><td> </td><td>$signum, </td></tr><tr><td> </td><td>$timeout, </td></tr><tr><td> </td><td>$protocol, </td></tr><tr><td> </td><td>$funcname<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Given an xmlrpc server and a method name, creates a php wrapper
function that will call the remote method and return results using
native php types for both params and results. The generated php
function will return an xmlrpcresp object for failed xmlrpc
calls.</p><p>The second syntax is deprecated, and is listed here only for
backward compatibility.</p><p>The server must support the
<code class="methodname">system.methodSignature</code> xmlrpc method call for
this function to work.</p><p>The <em class="parameter"><code>client</code></em> param must be a valid
xmlrpc_client object, previously created with the address of the
target xmlrpc server, and to which the preferred communication options
have been set.</p><p>The optional parameters can be passed as array key,value pairs
in the <em class="parameter"><code>extra_options</code></em> param.</p><p>The <em class="parameter"><code>signum</code></em> optional param has the purpose
of indicating which method signature to use, if the given server
method has multiple signatures (defaults to 0).</p><p>The <em class="parameter"><code>timeout</code></em> and
<em class="parameter"><code>protocol</code></em> optional params are the same as in the
<code class="methodname">xmlrpc_client::send()</code> method.</p><p>If set, the optional <em class="parameter"><code>new_function_name</code></em>
parameter indicates which name should be used for the generated
function. In case it is not set the function name will be
auto-generated.</p><p>If the <code class="literal">return_source</code> optional parameter is
set, the function will return the php source code to build the wrapper
function, instead of evaluating it (useful to save the code and use it
later as stand-alone xmlrpc client).</p><p>If the <code class="literal">encode_php_objs</code> optional parameter is
set, instances of php objects later passed as parameters to the newly
created function will receive a 'special' treatment that allows the
server to rebuild them as php objects instead of simple arrays. Note
that this entails using a "slightly augmented" version of the xmlrpc
protocol (ie. using element attributes), which might not be understood
by xmlrpc servers implemented using other libraries.</p><p>If the <code class="literal">decode_php_objs</code> optional parameter is
set, instances of php objects that have been appropriately encoded by
the server using a coordinate option will be deserialized as php
objects instead of simple arrays (the same class definition should be
present server side and client side).</p><p><span class="emphasis"><em>Note that this might pose a security risk</em></span>,
since in order to rebuild the object instances their constructor
method has to be invoked, and this means that the remote server can
trigger execution of unforeseen php code on the client: not really a
code injection, but almost. Please enable this option only when you
trust the remote server.</p><p>In case of an error during generation of the wrapper function,
FALSE is returned, otherwise the name (or source code) of the new
function.</p><p>Known limitations: server must support
<code class="methodname">system.methodsignature</code> for the wanted xmlrpc
method; for methods that expose multiple signatures, only one can be
picked; for remote calls with nested xmlrpc params, the caller of the
generated php function has to encode on its own the params passed to
the php function if these are structs or arrays whose (sub)members
include values of type base64.</p><p>Note: calling the generated php function 'might' be slow: a new
xmlrpc client is created on every invocation and an xmlrpc-connection
opened+closed. An extra 'debug' param is appended to the parameter
list of the generated php function, useful for debugging
purposes.</p><p>Example usage:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://phpxmlrpc.sourceforge.net/server.php'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$function&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">wrap_xmlrpc_method</span><span style="color: #007700">(</span><span style="color: #0000BB">$client</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'examples.getStateName'</span><span style="color: #007700">);<br /><br />if&nbsp;(!</span><span style="color: #0000BB">$function</span><span style="color: #007700">)<br />&nbsp;&nbsp;die(</span><span style="color: #DD0000">'Cannot&nbsp;introspect&nbsp;remote&nbsp;method'</span><span style="color: #007700">);<br />else&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$stateno&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">15</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$statename&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$function</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">);<br />&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">is_a</span><span style="color: #007700">(</span><span style="color: #0000BB">$statename</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'xmlrpcresp'</span><span style="color: #007700">))&nbsp;</span><span style="color: #FF8000">//&nbsp;call&nbsp;failed<br />&nbsp;&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'Call&nbsp;failed:&nbsp;'</span><span style="color: #007700">.</span><span style="color: #0000BB">$statename</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">().</span><span style="color: #DD0000">'.&nbsp;Calling&nbsp;again&nbsp;with&nbsp;debug&nbsp;on'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$function</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"OK,&nbsp;state&nbsp;nr.&nbsp;</span><span style="color: #0000BB">$stateno</span><span style="color: #DD0000">&nbsp;is&nbsp;</span><span style="color: #0000BB">$statename</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br />}</span>
</span>
</code></pre></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="wrap_php_function"></a>wrap_php_function</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">array<b class="fsfunc">wrap_php_function</b>(</code></td><td>string<var class="pdparam">$funcname</var>, </td></tr><tr><td> </td><td>string<var class="pdparam">$wrapper_function_name</var>, </td></tr><tr><td> </td><td>array<var class="pdparam">$extra_options</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Given a user-defined PHP function, create a PHP 'wrapper'
function that can be exposed as xmlrpc method from an xmlrpc_server
object and called from remote clients, and return the appropriate
definition to be added to a server's dispatch map.</p><p>The optional <em class="parameter"><code>$wrapper_function_name</code></em>
specifies the name that will be used for the auto-generated
function.</p><p>Since php is a typeless language, to infer types of input and
output parameters, it relies on parsing the javadoc-style comment
block associated with the given function. Usage of xmlrpc native types
(such as datetime.dateTime.iso8601 and base64) in the docblock @param
tag is also allowed, if you need the php function to receive/send data
in that particular format (note that base64 encoding/decoding is
transparently carried out by the lib, while datetime vals are passed
around as strings).</p><p>Known limitations: requires PHP 5.0.3 +; only works for
user-defined functions, not for PHP internal functions (reflection
does not support retrieving number/type of params for those); the
wrapped php function will not be able to programmatically return an
xmlrpc error response.</p><p>If the <code class="literal">return_source</code> optional parameter is
set, the function will return the php source code to build the wrapper
function, instead of evaluating it (useful to save the code and use it
later in a stand-alone xmlrpc server). It will be in the stored in the
<code class="literal">source</code> member of the returned array.</p><p>If the <code class="literal">suppress_warnings</code> optional parameter
is set, any runtime warning generated while processing the
user-defined php function will be catched and not be printed in the
generated xml response.</p><p>If the <em class="parameter"><code>extra_options</code></em> array contains the
<code class="literal">encode_php_objs</code> value, wrapped functions returning
php objects will generate "special" xmlrpc responses: when the xmlrpc
decoding of those responses is carried out by this same lib, using the
appropriate param in php_xmlrpc_decode(), the objects will be
rebuilt.</p><p>In short: php objects can be serialized, too (except for their
resource members), using this function. Other libs might choke on the
very same xml that will be generated in this case (i.e. it has a
nonstandard attribute on struct element tags)</p><p>If the <code class="literal">decode_php_objs</code> optional parameter is
set, instances of php objects that have been appropriately encoded by
the client using a coordinate option will be deserialized and passed
to the user function as php objects instead of simple arrays (the same
class definition should be present server side and client
side).</p><p><span class="emphasis"><em>Note that this might pose a security risk</em></span>,
since in order to rebuild the object instances their constructor
method has to be invoked, and this means that the remote client can
trigger execution of unforeseen php code on the server: not really a
code injection, but almost. Please enable this option only when you
trust the remote clients.</p><p>Example usage:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #FF8000">/**<br />*&nbsp;State&nbsp;name&nbsp;from&nbsp;state&nbsp;number&nbsp;decoder.&nbsp;NB:&nbsp;do&nbsp;NOT&nbsp;remove&nbsp;this&nbsp;comment&nbsp;block.<br />*&nbsp;@param&nbsp;integer&nbsp;$stateno&nbsp;the&nbsp;state&nbsp;number<br />*&nbsp;@return&nbsp;string&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;state&nbsp;(or&nbsp;error&nbsp;description)<br />*/<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">findstate</span><span style="color: #007700">(</span><span style="color: #0000BB">$stateno</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">$stateNames</span><span style="color: #007700">;<br />&nbsp;&nbsp;if&nbsp;(isset(</span><span style="color: #0000BB">$stateNames</span><span style="color: #007700">[</span><span style="color: #0000BB">$stateno</span><span style="color: #007700">-</span><span style="color: #0000BB">1</span><span style="color: #007700">]))<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$stateNames</span><span style="color: #007700">[</span><span style="color: #0000BB">$stateno</span><span style="color: #007700">-</span><span style="color: #0000BB">1</span><span style="color: #007700">];<br />&nbsp;&nbsp;}<br />&nbsp;&nbsp;else<br />&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #DD0000">"I&nbsp;don't&nbsp;have&nbsp;a&nbsp;state&nbsp;for&nbsp;the&nbsp;index&nbsp;'"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$stateno&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"'"</span><span style="color: #007700">;<br />&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;wrap&nbsp;php&nbsp;function,&nbsp;build&nbsp;xmlrpc&nbsp;server<br /></span><span style="color: #0000BB">$methods&nbsp;</span><span style="color: #007700">=&nbsp;array();<br /></span><span style="color: #0000BB">$findstate_sig&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">wrap_php_function</span><span style="color: #007700">(</span><span style="color: #DD0000">'findstate'</span><span style="color: #007700">);<br />if&nbsp;(</span><span style="color: #0000BB">$findstate_sig</span><span style="color: #007700">)<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$methods</span><span style="color: #007700">[</span><span style="color: #DD0000">'examples.getStateName'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">$findstate_sig</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$srv&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_server</span><span style="color: #007700">(</span><span style="color: #0000BB">$methods</span><span style="color: #007700">);</span>
</span>
</code></pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch09s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Easy use with nested PHP values </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Functions removed from the library</td></tr></table></div></body></html>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Functions removed from the library</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch09.html" title="Chapter 9. Helper functions" /><link rel="prev" href="ch09s03.html" title="Automatic conversion of php functions into xmlrpc methods (and vice versa)" /><link rel="next" href="ch09s05.html" title="Debugging aids" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Functions removed from the library</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09s03.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Helper functions</th><td width="20%" align="right"> <a accesskey="n" href="ch09s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="deprecated"></a>Functions removed from the library</h2></div></div></div><p>The following two functions have been deprecated in version 1.1 of
the library, and removed in version 2, in order to avoid conflicts with
the EPI xml-rpc library, which also defines two functions with the same
names.</p><p>To ease the transition to the new naming scheme and avoid breaking
existing implementations, the following scheme has been adopted:
</p><div class="itemizedlist"><ul type="disc"><li><p>If EPI-XMLRPC is not active in the current PHP installation,
the constant <code class="literal">XMLRPC_EPI_ENABLED</code> will be set to
<code class="literal">'0'</code></p></li><li><p>If EPI-XMLRPC is active in the current PHP installation, the
constant <code class="literal">XMLRPC_EPI_ENABLED</code> will be set to
<code class="literal">'1'</code></p></li></ul></div><p>The following documentation is kept for historical
reference:</p><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="xmlrpcdecode"></a>xmlrpc_decode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">mixed<b class="fsfunc">xmlrpc_decode</b>(</code></td><td>xmlrpcval<var class="pdparam">$xmlrpc_val</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Alias for php_xmlrpc_decode.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="xmlrpcencode"></a>xmlrpc_encode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">xmlrpcval<b class="fsfunc">xmlrpc_encode</b>(</code></td><td>mixed<var class="pdparam">$phpval</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Alias for php_xmlrpc_encode.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch09s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Automatic conversion of php functions into xmlrpc methods (and
vice versa) </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Debugging aids</td></tr></table></div></body></html>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Debugging aids</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch09.html" title="Chapter 9. Helper functions" /><link rel="prev" href="ch09s04.html" title="Functions removed from the library" /><link rel="next" href="ch10.html" title="Chapter 10. Reserved methods" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Debugging aids</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09s04.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Helper functions</th><td width="20%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="debugging"></a>Debugging aids</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="id938694"></a>xmlrpc_debugmsg</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void<b class="fsfunc">xmlrpc_debugmsg</b>(</code></td><td>string<var class="pdparam">$debugstring</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>Sends the contents of <em class="parameter"><code>$debugstring</code></em> in XML
comments in the server return payload. If a PHP client has debugging
turned on, the user will be able to see server debug
information.</p><p>Use this function in your methods so you can pass back
diagnostic information. It is only available from
<code class="filename">xmlrpcs.inc</code>.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Functions removed from the library </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Reserved methods</td></tr></table></div></body></html>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 10. Reserved methods</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch09s05.html" title="Debugging aids" /><link rel="next" href="ch10s02.html" title="system.listMethods" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 10. Reserved methods</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09s05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch10s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="reserved"></a>Chapter 10. Reserved methods</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch10.html#id938774">system.getCapabilities</a></span></dt><dt><span class="sect1"><a href="ch10s02.html">system.listMethods</a></span></dt><dt><span class="sect1"><a href="ch10s03.html">system.methodSignature</a></span></dt><dt><span class="sect1"><a href="ch10s04.html">system.methodHelp</a></span></dt><dt><span class="sect1"><a href="ch10s05.html">system.multicall</a></span></dt></dl></div><p>In order to extend the functionality offered by XML-RPC servers
without impacting on the protocol, reserved methods are supported in this
release.</p><p>All methods starting with <code class="function">system.</code> are
considered reserved by the server. PHP for XML-RPC itself provides four
special methods, detailed in this chapter.</p><p>Note that all server objects will automatically respond to clients
querying these methods, unless the property
<span class="property">allow_system_funcs</span> has been set to
<code class="constant">false</code> before calling the
<code class="methodname">service()</code> method. This might pose a security risk
if the server is exposed to public access, e.g. on the internet.</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938774"></a>system.getCapabilities</h2></div></div></div><p></p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09s05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch10s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Debugging aids </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> system.listMethods</td></tr></table></div></body></html>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>system.listMethods</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link rel="prev" href="ch10.html" title="Chapter 10. Reserved methods" /><link rel="next" href="ch10s03.html" title="system.methodSignature" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">system.listMethods</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Reserved methods</th><td width="20%" align="right"> <a accesskey="n" href="ch10s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938783"></a>system.listMethods</h2></div></div></div><p>This method may be used to enumerate the methods implemented by
the XML-RPC server.</p><p>The <code class="function">system.listMethods</code> method requires no
parameters. It returns an array of strings, each of which is the name of
a method implemented by the server.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch10s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 10. Reserved methods </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> system.methodSignature</td></tr></table></div></body></html>

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>system.methodSignature</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link rel="prev" href="ch10s02.html" title="system.listMethods" /><link rel="next" href="ch10s04.html" title="system.methodHelp" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">system.methodSignature</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s02.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Reserved methods</th><td width="20%" align="right"> <a accesskey="n" href="ch10s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sysmethodsig"></a>system.methodSignature</h2></div></div></div><p>This method takes one parameter, the name of a method implemented
by the XML-RPC server.</p><p>It returns an array of possible signatures for this method. A
signature is an array of types. The first of these types is the return
type of the method, the rest are parameters.</p><p>Multiple signatures (i.e. overloading) are permitted: this is the
reason that an array of signatures are returned by this method.</p><p>Signatures themselves are restricted to the top level parameters
expected by a method. For instance if a method expects one array of
structs as a parameter, and it returns a string, its signature is simply
"string, array". If it expects three integers, its signature is "string,
int, int, int".</p><p>For parameters that can be of more than one type, the "undefined"
string is supported.</p><p>If no signature is defined for the method, a not-array value is
returned. Therefore this is the way to test for a non-signature, if
<em class="parameter"><code>$resp</code></em> below is the response object from a method
call to <code class="function">system.methodSignature</code>:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">();<br />if&nbsp;(</span><span style="color: #0000BB">$v</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">kindOf</span><span style="color: #007700">()&nbsp;!=&nbsp;</span><span style="color: #DD0000">"array"</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;then&nbsp;the&nbsp;method&nbsp;did&nbsp;not&nbsp;have&nbsp;a&nbsp;signature&nbsp;defined<br /></span><span style="color: #007700">}</span>
</span>
</code></pre><p>See the <code class="filename">introspect.php</code> demo included in this
distribution for an example of using this method.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch10s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">system.listMethods </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> system.methodHelp</td></tr></table></div></body></html>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>system.methodHelp</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link rel="prev" href="ch10s03.html" title="system.methodSignature" /><link rel="next" href="ch10s05.html" title="system.multicall" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">system.methodHelp</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s03.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Reserved methods</th><td width="20%" align="right"> <a accesskey="n" href="ch10s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sysmethhelp"></a>system.methodHelp</h2></div></div></div><p>This method takes one parameter, the name of a method implemented
by the XML-RPC server.</p><p>It returns a documentation string describing the use of that
method. If no such string is available, an empty string is
returned.</p><p>The documentation string may contain HTML markup.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch10s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">system.methodSignature </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> system.multicall</td></tr></table></div></body></html>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>system.multicall</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch10.html" title="Chapter 10. Reserved methods" /><link rel="prev" href="ch10s04.html" title="system.methodHelp" /><link rel="next" href="ch11.html" title="Chapter 11. Examples" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">system.multicall</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s04.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Reserved methods</th><td width="20%" align="right"> <a accesskey="n" href="ch11.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938871"></a>system.multicall</h2></div></div></div><p>This method takes one parameter, an array of 'request' struct
types. Each request struct must contain a
<em class="parameter"><code>methodName</code></em> member of type string and a
<em class="parameter"><code>params</code></em> member of type array, and corresponds to
the invocation of the corresponding method.</p><p>It returns a response of type array, with each value of the array
being either an error struct (containing the faultCode and faultString
members) or the successful response value of the corresponding single
method call.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch11.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">system.methodHelp </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 11. Examples</td></tr></table></div></body></html>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 11. Examples</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch10s05.html" title="system.multicall" /><link rel="next" href="ch11s02.html" title="Executing a multicall call" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 11. Examples</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch10s05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch11s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="examples"></a>Chapter 11. Examples</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch11.html#statename">XML-RPC client: state name query</a></span></dt><dt><span class="sect1"><a href="ch11s02.html">Executing a multicall call</a></span></dt></dl></div><p>The best examples are to be found in the sample files included with
the distribution. Some are included here.</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="statename"></a>XML-RPC client: state name query</h2></div></div></div><p>Code to get the corresponding state name from a number (1-50) from
the demo server available on SourceForge</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">&nbsp;&nbsp;$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span style="color: #DD0000">'examples.getStateName'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;array(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #0000BB">$HTTP_POST_VARS</span><span style="color: #007700">[</span><span style="color: #DD0000">"stateno"</span><span style="color: #007700">],&nbsp;</span><span style="color: #DD0000">"int"</span><span style="color: #007700">)));<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #DD0000">"/server.php"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"phpxmlrpc.sourceforge.net"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$r&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">$m</span><span style="color: #007700">);<br />&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$v&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"State&nbsp;number&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$HTTP_POST_VARS</span><span style="color: #007700">[</span><span style="color: #DD0000">"stateno"</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #DD0000">"&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$v</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">scalarval</span><span style="color: #007700">())&nbsp;.&nbsp;</span><span style="color: #DD0000">"&lt;BR&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"&lt;HR&gt;I&nbsp;got&nbsp;this&nbsp;value&nbsp;back&lt;BR&gt;&lt;PRE&gt;"&nbsp;</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">serialize</span><span style="color: #007700">())&nbsp;.&nbsp;</span><span style="color: #DD0000">"&lt;/PRE&gt;&lt;HR&gt;\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"Fault&nbsp;&lt;BR&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"Code:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())&nbsp;.&nbsp;</span><span style="color: #DD0000">"&lt;BR&gt;"&nbsp;</span><span style="color: #007700">.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">"Reason:&nbsp;'"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">htmlentities</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultString</span><span style="color: #007700">())&nbsp;.&nbsp;</span><span style="color: #DD0000">"'&lt;BR&gt;"</span><span style="color: #007700">;<br />&nbsp;&nbsp;}</span>
</span>
</code></pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch11s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">system.multicall </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Executing a multicall call</td></tr></table></div></body></html>

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Executing a multicall call</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch11.html" title="Chapter 11. Examples" /><link rel="prev" href="ch11.html" title="Chapter 11. Examples" /><link rel="next" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Executing a multicall call</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11.html">Prev</a> </td><th width="60%" align="center">Chapter 11. Examples</th><td width="20%" align="right"> <a accesskey="n" href="ch12.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938922"></a>Executing a multicall call</h2></div></div></div><p>To be documented...</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch11.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 11. Examples </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 12. Frequently Asked Questions</td></tr></table></div></body></html>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 12. Frequently Asked Questions</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="index.html" title="XML-RPC for PHP" /><link rel="prev" href="ch11s02.html" title="Executing a multicall call" /><link rel="next" href="ch12s02.html" title="Is there any limitation on the size of the requests / responses that can be successfully sent?" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 12. Frequently Asked Questions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11s02.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch12s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="faq"></a>Chapter 12. Frequently Asked Questions</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch12.html#id938942">How to send custom XML as payload of a method call</a></span></dt><dt><span class="sect1"><a href="ch12s02.html">Is there any limitation on the size of the requests / responses
that can be successfully sent?</a></span></dt><dt><span class="sect1"><a href="ch12s03.html">My server (client) returns an error whenever the client (server)
returns accented characters</a></span></dt><dt><span class="sect1"><a href="ch12s04.html">How to enable long-lasting method calls</a></span></dt><dt><span class="sect1"><a href="ch12s05.html">My client returns "XML-RPC Fault #2: Invalid return payload:
enable debugging to examine incoming payload": what should I do?</a></span></dt><dt><span class="sect1"><a href="ch12s06.html">How can I save to a file the xml of the xmlrpc responses received
from servers?</a></span></dt><dt><span class="sect1"><a href="ch12s07.html">Can I use the ms windows character set?</a></span></dt><dt><span class="sect1"><a href="ch12s08.html">Does the library support using cookies / http sessions?</a></span></dt></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938942"></a>How to send custom XML as payload of a method call</h2></div></div></div><p>Unfortunately, at the time the XML-RPC spec was designed, support
for namespaces in XML was not as ubiquitous as it is now. As a
consequence, no support was provided in the protocol for embedding XML
elements from other namespaces into an xmlrpc request.</p><p>To send an XML "chunk" as payload of a method call or response,
two options are available: either send the complete XML block as a
string xmlrpc value, or as a base64 value. Since the '&lt;' character in
string values is encoded as '&amp;lt;' in the xml payload of the method
call, the XML string will not break the surrounding xmlrpc, unless
characters outside of the assumed character set are used. The second
method has the added benefits of working independently of the charset
encoding used for the xml to be transmitted, and preserving exactly
whitespace, whilst incurring in some extra message length and cpu load
(for carrying out the base64 encoding/decoding).</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11s02.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch12s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Executing a multicall call </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Is there any limitation on the size of the requests / responses
that can be successfully sent?</td></tr></table></div></body></html>

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Is there any limitation on the size of the requests / responses that can be successfully sent?</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="prev" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="next" href="ch12s03.html" title="My server (client) returns an error whenever the client (server) returns accented characters" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Is there any limitation on the size of the requests / responses
that can be successfully sent?</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" href="ch12s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938956"></a>Is there any limitation on the size of the requests / responses
that can be successfully sent?</h2></div></div></div><p>Yes. But I have no hard figure to give; it most likely will depend
on the version of PHP in usage and its configuration.</p><p>Keep in mind that this library is not optimized for speed nor for
memory usage. Better alternatives exist when there are strict
requirements on throughput or resource usage, such as the php native
xmlrpc extension (see the PHP manual for more information).</p><p>Keep in mind also that HTTP is probably not the best choice in
such a situation, and XML is a deadly enemy. CSV formatted data over
socket would be much more efficient.</p><p>If you really need to move a massive amount of data around, and
you are crazy enough to do it using phpxmlrpc, your best bet is to
bypass usage of the xmlrpcval objects, at least in the decoding phase,
and have the server (or client) object return to the calling function
directly php values (see <code class="varname">xmlrpc_client::return_type</code>
and <code class="varname">xmlrpc_server::functions_parameters_type</code> for more
details).</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 12. Frequently Asked Questions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> My server (client) returns an error whenever the client (server)
returns accented characters</td></tr></table></div></body></html>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>My server (client) returns an error whenever the client (server) returns accented characters</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="prev" href="ch12s02.html" title="Is there any limitation on the size of the requests / responses that can be successfully sent?" /><link rel="next" href="ch12s04.html" title="How to enable long-lasting method calls" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">My server (client) returns an error whenever the client (server)
returns accented characters</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s02.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" href="ch12s04.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938985"></a>My server (client) returns an error whenever the client (server)
returns accented characters</h2></div></div></div><p>To be documented...</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Is there any limitation on the size of the requests / responses
that can be successfully sent? </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> How to enable long-lasting method calls</td></tr></table></div></body></html>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>How to enable long-lasting method calls</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="prev" href="ch12s03.html" title="My server (client) returns an error whenever the client (server) returns accented characters" /><link rel="next" href="ch12s05.html" title="My client returns &quot;XML-RPC Fault #2: Invalid return payload: enable debugging to examine incoming payload&quot;: what should I do?" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">How to enable long-lasting method calls</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s03.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" href="ch12s05.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id938996"></a>How to enable long-lasting method calls</h2></div></div></div><p>To be documented...</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12s05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">My server (client) returns an error whenever the client (server)
returns accented characters </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> My client returns "XML-RPC Fault #2: Invalid return payload:
enable debugging to examine incoming payload": what should I do?</td></tr></table></div></body></html>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>My client returns "XML-RPC Fault #2: Invalid return payload: enable debugging to examine incoming payload": what should I do?</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="prev" href="ch12s04.html" title="How to enable long-lasting method calls" /><link rel="next" href="ch12s06.html" title="How can I save to a file the xml of the xmlrpc responses received from servers?" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">My client returns "XML-RPC Fault #2: Invalid return payload:
enable debugging to examine incoming payload": what should I do?</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s04.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" href="ch12s06.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id939006"></a>My client returns "XML-RPC Fault #2: Invalid return payload:
enable debugging to examine incoming payload": what should I do?</h2></div></div></div><p>The response you are seeing is a default error response that the
client object returns to the php application when the server did not
respond to the call with a valid xmlrpc response.</p><p>The most likely cause is that you are not using the correct URL
when creating the client object, or you do not have appropriate access
rights to the web page you are requesting, or some other common http
misconfiguration.</p><p>To find out what the server is really returning to your client,
you have to enable the debug mode of the client, using
$client-&gt;setdebug(1);</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12s06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">How to enable long-lasting method calls </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> How can I save to a file the xml of the xmlrpc responses received
from servers?</td></tr></table></div></body></html>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>How can I save to a file the xml of the xmlrpc responses received from servers?</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="prev" href="ch12s05.html" title="My client returns &quot;XML-RPC Fault #2: Invalid return payload: enable debugging to examine incoming payload&quot;: what should I do?" /><link rel="next" href="ch12s07.html" title="Can I use the ms windows character set?" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">How can I save to a file the xml of the xmlrpc responses received
from servers?</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s05.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" href="ch12s07.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id939024"></a>How can I save to a file the xml of the xmlrpc responses received
from servers?</h2></div></div></div><p>If what you need is to save the responses received from the server
as xml, you have two options:</p><p>1- use the serialize() method on the response object.</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$resp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">$msg</span><span style="color: #007700">);<br />if&nbsp;(!</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$data_to_be_saved&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">serialize</span><span style="color: #007700">();</span>
</span>
</code></pre><p>Note that this will not be 100% accurate, since the xml generated
by the response object can be different from the xml received,
especially if there is some character set conversion involved, or such
(eg. if you receive an empty string tag as &lt;string/&gt;, serialize()
will output &lt;string&gt;&lt;/string&gt;), or if the server sent back
as response something invalid (in which case the xml generated client
side using serialize() will correspond to the error response generated
internally by the lib).</p><p>2 - set the client object to return the raw xml received instead
of the decoded objects:</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$client&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpc_client</span><span style="color: #007700">(</span><span style="color: #0000BB">$url</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">return_type&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'xml'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$resp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #0000BB">$msg</span><span style="color: #007700">);<br />if&nbsp;(!</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$data_to_be_saved&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">value</span><span style="color: #007700">();</span>
</span>
</code></pre><p>Note that using this method the xml response response will not be
parsed at all by the library, only the http communication protocol will
be checked. This means that xmlrpc responses sent by the server that
would have generated an error response on the client (eg. malformed xml,
responses that have faultcode set, etc...) now will not be flagged as
invalid, and you might end up saving not valid xml but random
junk...</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12s07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">My client returns "XML-RPC Fault #2: Invalid return payload:
enable debugging to examine incoming payload": what should I do? </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Can I use the ms windows character set?</td></tr></table></div></body></html>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Can I use the ms windows character set?</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="prev" href="ch12s06.html" title="How can I save to a file the xml of the xmlrpc responses received from servers?" /><link rel="next" href="ch12s08.html" title="Does the library support using cookies / http sessions?" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Can I use the ms windows character set?</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s06.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" href="ch12s08.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id939059"></a>Can I use the ms windows character set?</h2></div></div></div><p>If the data your application is using comes from a Microsoft
application, there are some chances that the character set used to
encode it is CP1252 (the same might apply to data received from an
external xmlrpc server/client, but it is quite rare to find xmlrpc
toolkits that encode to CP1252 instead of UTF8). It is a character set
which is "almost" compatible with ISO 8859-1, but for a few extra
characters.</p><p>PHP-XMLRPC only supports the ISO 8859-1 and UTF8 character sets.
The net result of this situation is that those extra characters will not
be properly encoded, and will be received at the other end of the
XML-RPC tranmission as "garbled data". Unfortunately the library cannot
provide real support for CP1252 because of limitations in the PHP 4 xml
parser. Luckily, we tried our best to support this character set anyway,
and, since version 2.2.1, there is some form of support, left commented
in the code.</p><p>To properly encode outgoing data that is natively in CP1252, you
will have to uncomment all relative code in the file
<code class="filename">xmlrpc.inc</code> (you can search for the string "1252"),
then set <code class="code">$GLOBALS['xmlrpc_internalencoding']='CP1252';</code>
Please note that all incoming data will then be fed to your application
as UTF-8 to avoid any potentail data loss.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">How can I save to a file the xml of the xmlrpc responses received
from servers? </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Does the library support using cookies / http sessions?</td></tr></table></div></body></html>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Does the library support using cookies / http sessions?</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="up" href="ch12.html" title="Chapter 12. Frequently Asked Questions" /><link rel="prev" href="ch12s07.html" title="Can I use the ms windows character set?" /><link rel="next" href="apa.html" title="Appendix A. Integration with the PHP xmlrpc extension" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Does the library support using cookies / http sessions?</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch12s07.html">Prev</a> </td><th width="60%" align="center">Chapter 12. Frequently Asked Questions</th><td width="20%" align="right"> <a accesskey="n" href="apa.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id939878"></a>Does the library support using cookies / http sessions?</h2></div></div></div><p>In short: yes, but a little coding is needed to make it
happen.</p><p>The code below uses sessions to e.g. let the client store a value
on the server and retrieve it later.</p><pre class="programlisting"><code><span style="color: #000000">
<span style="color: #0000BB">$resp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span style="color: #DD0000">'registervalue'</span><span style="color: #007700">,&nbsp;array(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">),&nbsp;new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">))));<br />if&nbsp;(!</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">())<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$cookies&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$resp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cookies</span><span style="color: #007700">();<br />&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">array_key_exists</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHPSESSID'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$cookies</span><span style="color: #007700">))&nbsp;</span><span style="color: #FF8000">//&nbsp;nb:&nbsp;make&nbsp;sure&nbsp;to&nbsp;use&nbsp;the&nbsp;correct&nbsp;session&nbsp;cookie&nbsp;name<br />&nbsp;&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$session_id&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$cookies</span><span style="color: #007700">[</span><span style="color: #DD0000">'PHPSESSID'</span><span style="color: #007700">][</span><span style="color: #DD0000">'value'</span><span style="color: #007700">];<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;do&nbsp;some&nbsp;other&nbsp;stuff&nbsp;here...<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setcookie</span><span style="color: #007700">(</span><span style="color: #DD0000">'PHPSESSID'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$session_id</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$val&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(new&nbsp;</span><span style="color: #0000BB">xmlrpcmsg</span><span style="color: #007700">(</span><span style="color: #DD0000">'getvalue'</span><span style="color: #007700">,&nbsp;array(new&nbsp;</span><span style="color: #0000BB">xmlrpcval</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">)));<br />&nbsp;&nbsp;}<br />}</span>
</span>
</code></pre><p>Server-side sessions are handled normally like in any other
php application. Please see the php manual for more information about
sessions.</p><p>NB: unlike web browsers, not all xmlrpc clients support usage of
http cookies. If you have troubles with sessions and control only the
server side of the communication, please check with the makers of the
xmlrpc client in use.</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch12s07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch12.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="apa.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Can I use the ms windows character set? </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Appendix A. Integration with the PHP xmlrpc extension</td></tr></table></div></body></html>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>XML-RPC for PHP</title><link rel="stylesheet" href="xmlrpc.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="index.html" title="XML-RPC for PHP" /><link rel="next" href="ch01.html" title="Chapter 1. Introduction" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">XML-RPC for PHP</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr></table><hr /></div><div class="book" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="id916208"></a>XML-RPC for PHP</h1></div><div><h2 class="subtitle">version 3.0.0 beta</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Edd</span> <span class="surname">Dumbill</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Gaetano</span> <span class="surname">Giunta</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Miles</span> <span class="surname">Lott</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Justin R.</span> <span class="surname">Miller</span></h3></div><div class="author"><h3 class="author"><span class="firstname">Andres</span> <span class="surname">Salomon</span></h3></div></div></div><div><p class="copyright">Copyright © 1999,2000,2001 Edd Dumbill, Useful Information Company</p></div><div><div class="legalnotice"><a id="id916294"></a><p>All rights reserved.</p><p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:</p><div class="itemizedlist"><ul type="disc"><li><p>Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.</p></li><li><p>Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.</p></li><li><p>Neither the name of the "XML-RPC for PHP" nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.</p></li></ul></div><p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p></div></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="ch01.html">1. Introduction</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch01.html#id930303">Acknowledgements</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch02.html">2. What's new</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch02.html#id930465">3.0.0 beta</a></span></dt><dt><span class="sect1"><a href="ch02s02.html">2.2.2</a></span></dt><dt><span class="sect1"><a href="ch02s03.html">2.2.1</a></span></dt><dt><span class="sect1"><a href="ch02s04.html">2.2</a></span></dt><dt><span class="sect1"><a href="ch02s05.html">2.1</a></span></dt><dt><span class="sect1"><a href="ch02s06.html">2.0 final</a></span></dt><dt><span class="sect1"><a href="ch02s07.html">2.0 Release candidate 3</a></span></dt><dt><span class="sect1"><a href="ch02s08.html">2.0 Release candidate 2</a></span></dt><dt><span class="sect1"><a href="ch02s09.html">2.0 Release candidate 1</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch03.html">3. System Requirements</a></span></dt><dt><span class="chapter"><a href="ch04.html">4. Files in the distribution</a></span></dt><dt><span class="chapter"><a href="ch05.html">5. Known bugs and limitations</a></span></dt><dt><span class="chapter"><a href="ch06.html">6. Support</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch06.html#id932516">Online Support</a></span></dt><dt><span class="sect1"><a href="ch06s02.html">The Jellyfish Book</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch07.html">7. Class documentation</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch07.html#xmlrpcval">xmlrpcval</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07.html#id932680">Notes on types</a></span></dt><dt><span class="sect2"><a href="ch07.html#xmlrpcval-creation">Creation</a></span></dt><dt><span class="sect2"><a href="ch07.html#xmlrpcval-methods">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s02.html">xmlrpcmsg</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s02.html#id934064">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s02.html#id934152">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s03.html">xmlrpc_client</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s03.html#id934526">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s03.html#id934666">Methods</a></span></dt><dt><span class="sect2"><a href="ch07s03.html#id935796">Variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s04.html">xmlrpcresp</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s04.html#id935884">Creation</a></span></dt><dt><span class="sect2"><a href="ch07s04.html#id935971">Methods</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch07s05.html">xmlrpc_server</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch07s05.html#id936390">Method handler functions</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936453">The dispatch map</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#signatures">Method signatures</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936613">Delaying the server response</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936662">Modifying the server behaviour</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id936748">Fault reporting</a></span></dt><dt><span class="sect2"><a href="ch07s05.html#id937308">'New style' servers</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="ch08.html">8. Global variables</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch08.html#id937374">"Constant" variables</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch08.html#id937380">$xmlrpcerruser</a></span></dt><dt><span class="sect2"><a href="ch08.html#id937400">$xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble,
$xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray,
$xmlrpcStruct, $xmlrpcValue, $xmlrpcNull</a></span></dt><dt><span class="sect2"><a href="ch08.html#id937415">$xmlrpcTypes, $xmlrpc_valid_parents, $xmlrpcerr, $xmlrpcstr,
$xmlrpcerrxml, $xmlrpc_backslash, $_xh, $xml_iso88591_Entities,
$xmlEntities, $xmlrpcs_capabilities</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch08s02.html">Variables whose value can be modified</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch08s02.html#xmlrpc-defencoding">xmlrpc_defencoding</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937475">xmlrpc_internalencoding</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937501">xmlrpcName</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937522">xmlrpcVersion</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937542">xmlrpc_null_extension</a></span></dt><dt><span class="sect2"><a href="ch08s02.html#id937560">xmlrpc_null_apache_encoding</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="ch09.html">9. Helper functions</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch09.html#id937598">Date functions</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09.html#iso8601encode">iso8601_encode</a></span></dt><dt><span class="sect2"><a href="ch09.html#iso8601decode">iso8601_decode</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s02.html">Easy use with nested PHP values</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s02.html#phpxmlrpcdecode">php_xmlrpc_decode</a></span></dt><dt><span class="sect2"><a href="ch09s02.html#phpxmlrpcencode">php_xmlrpc_encode</a></span></dt><dt><span class="sect2"><a href="ch09s02.html#id938212">php_xmlrpc_decode_xml</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s03.html">Automatic conversion of php functions into xmlrpc methods (and
vice versa)</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s03.html#id938280">wrap_xmlrpc_method</a></span></dt><dt><span class="sect2"><a href="ch09s03.html#wrap_php_function">wrap_php_function</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s04.html">Functions removed from the library</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s04.html#xmlrpcdecode">xmlrpc_decode</a></span></dt><dt><span class="sect2"><a href="ch09s04.html#xmlrpcencode">xmlrpc_encode</a></span></dt></dl></dd><dt><span class="sect1"><a href="ch09s05.html">Debugging aids</a></span></dt><dd><dl><dt><span class="sect2"><a href="ch09s05.html#id938694">xmlrpc_debugmsg</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="ch10.html">10. Reserved methods</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch10.html#id938774">system.getCapabilities</a></span></dt><dt><span class="sect1"><a href="ch10s02.html">system.listMethods</a></span></dt><dt><span class="sect1"><a href="ch10s03.html">system.methodSignature</a></span></dt><dt><span class="sect1"><a href="ch10s04.html">system.methodHelp</a></span></dt><dt><span class="sect1"><a href="ch10s05.html">system.multicall</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch11.html">11. Examples</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch11.html#statename">XML-RPC client: state name query</a></span></dt><dt><span class="sect1"><a href="ch11s02.html">Executing a multicall call</a></span></dt></dl></dd><dt><span class="chapter"><a href="ch12.html">12. Frequently Asked Questions</a></span></dt><dd><dl><dt><span class="sect1"><a href="ch12.html#id938942">How to send custom XML as payload of a method call</a></span></dt><dt><span class="sect1"><a href="ch12s02.html">Is there any limitation on the size of the requests / responses
that can be successfully sent?</a></span></dt><dt><span class="sect1"><a href="ch12s03.html">My server (client) returns an error whenever the client (server)
returns accented characters</a></span></dt><dt><span class="sect1"><a href="ch12s04.html">How to enable long-lasting method calls</a></span></dt><dt><span class="sect1"><a href="ch12s05.html">My client returns "XML-RPC Fault #2: Invalid return payload:
enable debugging to examine incoming payload": what should I do?</a></span></dt><dt><span class="sect1"><a href="ch12s06.html">How can I save to a file the xml of the xmlrpc responses received
from servers?</a></span></dt><dt><span class="sect1"><a href="ch12s07.html">Can I use the ms windows character set?</a></span></dt><dt><span class="sect1"><a href="ch12s08.html">Does the library support using cookies / http sessions?</a></span></dt></dl></dd><dt><span class="appendix"><a href="apa.html">A. Integration with the PHP xmlrpc extension</a></span></dt><dt><span class="appendix"><a href="apb.html">B. Substitution of the PHP xmlrpc extension</a></span></dt><dt><span class="appendix"><a href="apc.html">C. 'Enough of xmlrpcvals!': new style library usage</a></span></dt><dt><span class="appendix"><a href="apd.html">D. Usage of the debugger</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"> </td><td width="40%" align="right" valign="top"> Chapter 1. Introduction</td></tr></table></div></body></html>

File diff suppressed because it is too large Load Diff