1: PHP’s own SOAP
All webservices include Server and client.
To use PHP’s own soap, you must first install and enable the extension. Let’s look at the specific code
First of all, this is the server-side implementation:
Then there’s the client
PHP Code copies content to clipboard
It's that simple. At that time, it was just a very simple example. In fact, many communication mechanisms are implemented in this way!
////////////////////////////////////////////////// /////////////////////////////////
Two: PHPRPC
First go to the official website (http://www.phprpc.org/zh_CN/) to download the latest version of phprpc. After decompression, there will be relevant files. We divide the files (server and client files) as follows:
Server file:
Client files:
PHP Code copies content to clipboard
We put the server file in the server folder, then put the client file in the client folder, then create a new file (server.php) in the server folder as a service, and then create a new file in the client The file (client.php) serves as the client, and the respective codes are as follows:
Server side:
After mentioning wsdl above, we will talk about how to generate it.
////////////////////////////////////////////////// /////////////////////////////////
Three: Open Source NUSOAP
First go to the Internet to download the latest version of nusoap. The latest version now is 0.9.5. After decompression, you will get a lib folder. Put this file into the server and client respectively, and then serve The client and client create server.php and client.php files respectively as communication files.
The server files are as follows:
The client files are as follows:
////////////////////////////////////////////////////// /////////////////////////////
Four: HessianPHP
hessian Actually I Personally, I think it is not a webservice, it can only be said to be similar. Because it does not have the characteristics of webservice. It supports many languages. We only need to study the PHP version of HessianPHP now. The latest version to download is v2.0.3. After decompression, you will get a src directory, which is a core folder we need to use.
We renamed it to HessianPHP and placed it on the server and client respectively, and then created server.php and client.php files respectively.
Server side:
client: