Share the simple architecture and examples of four webservice implementations in php. phpwebservice_PHP tutorial

Source: Internet
Author: User
Share the simple architecture and examples of the four webservice implementations in php, phpwebservice. Share the simple architecture and examples of four webservices in php. phpwebservice 1: all the SOAP webservices of PHP include server and client ). Share the simple architecture and examples of the four webservice implementations in php, phpwebservice

I. PHP SOAP
All webservices include the server and client ).
To use php soap, you must first install and enable the extension. The specific code is as follows:
First, this is the server implementation:

Copy content from PHP Code to clipboard

Then the client

Copy content from PHP Code to clipboard

That's simple. at that time, this was just a simple example. In fact, many communication mechanisms were implemented in this way!
//////////////////////////////////////// ////////////////////////////////////////

II. PHPRPC
First go to the official website (http://www.phprpc.org/zh_CN/) to download the latest version of phprpc, unzip the relevant files, we divide the files (server and client files) as follows:
Server files:

Copy content from PHP Code to clipboard

Client files:

Copy content from PHP Code to clipboard

We put the server file in the server folder, then put the client file in the client folder, and then create a new file in the server folder (server. php) as a service, and then create a file on the client (client. php) as the client, the code is as follows:
Server:

Copy content from PHP Code to clipboard

As mentioned above, wsdl will be used to generate.
//////////////////////////////////////// ////////////////////////////////////////

3. open-source NUSOAP
First download the latest version of nusoap from the internet. The latest version is 0.9.5. decompress the package and you will get a lib folder. put the file to the server and client respectively, then, the server and the client establish the server respectively. php and client. php file as a communication file.
The server file is as follows:

Copy content from PHP Code to clipboard


The client file is as follows:

Copy content from PHP Code to clipboard

//////////////////////////////////////// ///////////////////////////////////////

4. HessianPHP
Hessian actually I personally think that he is not a webservice and can only be said to be similar. Because it does not have the characteristics of webservice. It supports many languages. now we only need to study the php version of HessianPHP. download the latest version v2.0.3 and unzip it to get a src directory, this directory is a core folder that we need to use.
We rename the name HessianPHP and place it on the server and client respectively, and then create the server. php and client. php files respectively.
Server:

Copy content from PHP Code to clipboard


Client:

Copy content from PHP Code to clipboard

Protocol 1: php soap all webservices include server and client )....

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.