Home arrow PHP arrow Page 4 - Using XML-RPC with PHP

Dissection of a XML-RPC Response - PHP

Do you want your Perl code on one server to call your PHP functions on another? "Impossible!" you say? Not with XML-RPC. XML-RPC is a standard way for any application to make requests and recieve responses from methods written in any language. Interested? I knew you would be.

TABLE OF CONTENTS:
  1. Using XML-RPC with PHP
  2. Compiling PHP with XML-RPC Support
  3. Dissection of a XML-RPC Call
  4. Dissection of a XML-RPC Response
  5. Creating an XML-RPC Server
  6. Creating an XML-RPC Client
  7. Conclusion
By: Lucas Marshall
Rating: starstarstarstarstar / 42
December 20, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
And here's the response to the call:

HTTP/1.1 200 OK Connection: close Content-Length: 191 Content-Type: text/xml Date: Tue, 18 Dec 2001 14:23:52 GMT Server: xmlrpc-epi-php/0.2 (PHP) <?xml version='1.0' encoding="iso-8859-1" ?> <methodResponse> <params> <param> <value> <string>Hello Lucas. How are you today?</string> </value> </param> </params> </methodResponse>
With your newly found knowledge of XML-RPC calls, it is easy to decipher standard responses. Normal responses consist of <params> container with <param> elements (and all they are heir to) sent inside <methodResponse> tags, but there is another type of response - a fault:

HTTP/1.1 200 OK Connection: close Content-Length: 356 Content-Type: text/xml Date: Tue, 18 Dec 2001 13:52:25 GMT Server: Apache/1.3.20 <?xml version='1.0' encoding="iso-8859-1" ?> <methodResponse> <fault> <value> <struct> <member> <name>faultCode</name> <value> <int>4</int> </value> </member> <member> <name>faultString</name> <value> <string>Too many parameters.</string> </value> </member> </struct> </value> </fault> </methodResponse>
As you can see, a fault response consists of a <methodResponse> containing a <fault> which contains a <value> which is a <struct> containing two elements, one named <faultCode>, an <int> and one named <faultString>, a <string>.

Please note that a response cannot contain both a <params> container and a <fault> container.

 
 
>>> More PHP Articles          >>> More By Lucas Marshall
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: