PHP extension: simple use of xmlrpc extension

Source: Internet
Author: User
WebService introduction WebService is generated for the communication of heterogeneous systems. its basic idea is to provide a standard mechanism for remote calls using XML-based HTTP, this eliminates the need to establish a new protocol. At present, there are two protocol standards for WebService communication, one is XML-RPC and the other is SOAP. The XML-RPC is relatively simple, the appearance time is relatively early, SOA Web Service introduction

Web Service is generated for the communication of heterogeneous systems. its basic idea is to use XML-based HTTP remote calls to provide a standard mechanism, this eliminates the need to establish a new protocol. At present, there are two protocol standards for Web Service communication, one is XML-RPC, the other is SOAP. XML-RPC is relatively simple, the appearance of time is relatively early, SOAP is more complex, mainly in some need of stability, robustness, security and complex interaction when using.
PHP integrates access to both XML-RPC and SOAP protocols, both of which are concentrated in xmlrpc extensions. In addition, in php pear, whether PHP 4 or PHP 5, has been integrated with the XML-RPC extension by default, and the extension has nothing to do with xmlrpc extension, can independently implement XML-RPC protocol interaction, if there is no xmlrpc extension, we recommend using the PEAR: XML-RPC extension.
Here we mainly use XML-RPC to briefly describe the Web Service interaction process, part of the content from the PHP Manual, more detailed content, it is recommended to refer to the manual.

Install xmlrpc extension

If the php extension of xmlrpc is not installed in your system, install it correctly. On the Windows platform, first put the extension php_xmlrpc.dll in the PHP installation directory to the C: Windows or C: Winnt directory,
(PHP4 extensions are in the C: phpextensions directory, and PHP5 extensions are in the C: phpext directory .)
Remove the semicolon ";" Before extension = php_xmlrpc.dll in php. ini under the apache installation directory, and then re-
After starting the Web server, check that phpinfo () has a XML-RPC project to see if the xmlrpc extension is correctly installed.

Sample code

Client code client. php:

 '; $ Xml = explode ($ split, $ response); $ xml = $ split. array_pop ($ xml); $ response = xmlrpc_decode ($ xml); // outputs the information print_r ($ response) obtained from the RPC server;?>

Server code server. php:

 

Run the output: All eggs will be birds one day.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.