n the world of Web development, two technologies have been very, very hot. These are Web services and PHP. The former because they allow big companies with big applications and big ideas to integrate easily; the latter because it is free, easy to use, and easy to learn. Their paths haven't crosseduntil now.
With PHP5, finally, there are native SOAP extensions that allow you to build and consume Web services with this excellent Web development language.
But before going any further, let's do a quick of Web services and SOAP. One of the biggest challenges facing the Internet generation was the ability to integrate different systems. It was all very nice to have a fancy J2EE application server managing your Web site, pooling connections to Enterprise Java Beans to keep everything running smoothly, but it was no good when you had to write thousands of lines of code to get it to interface to say, a credit card clearing house. Arguably the largest factor contributing to the dot-com crash was the sheer amount of money startups had to spend to hire staff to handle this back-end integration.
This is a problem that Web services were designed to solve. With your services giving data in a standard language (Extensible Markup Language, XML), defined in a standard way (Web Services Description Language, WSDL), located using a standard means (Universal Directory Discovery and Integration, UDDI) and accessed using a standard methodology (Simple Object Access Protocol, SOAP) all you had to do was build one, and everything would work neatly together.
While Web services built by this means are wildly popular, they have tended to exist primarily in the enterprise-level echelon, being used in a .NET or J2EE environment. Small companies and non-commercial Web sites, perhaps scared off by the high cost of infrastructure required to host Web services have gravitated more toward the ASP or PHP model.
With PHP5 you can now have the best of both worlds, as it is fully enabled to develop and consume Web services. In this article I'll show you how to set up a PHP5-based Web site running under Windows and IIS that consumes standard SOAP-based services.
| Author's Note: While the source code for this article is designed for PHP5, it should run on any variation of PHP that supports the SOAP extensions and any Web server that supports it.