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 )....