Share simple architectural methods and examples of four webservice implementations in php, phpwebservice_PHP tutorial

WBOY
Release: 2016-07-13 10:08:54
Original
934 people have browsed it

Share the simple architectural methods and examples of four webservice implementations in php, phpwebservice

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:

PHP Code copies content to clipboard

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:

PHP Code copies content to clipboard

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:

PHP Code copies content to clipboard

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:

PHP Code copies content to clipboard


The client files are as follows:

PHP Code copies content to clipboard

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

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:

PHP Code copies content to clipboard


client:

PHP Code copies content to clipboard

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/949210.htmlTechArticleSharing simple architectural methods and examples of four webservice implementations in php, phpwebservice 1: PHP's own SOAP All webservices Both include server and client. ...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!