Aug 11, 2011

How to use SOAP with PHP - very simple tutorial and example

Using SOAP with PHP can be very easy if you do everything right. First your PHP must be configured with --enable-soap. With Windows and WAMP you only need to check PHP > PHP extensions -> php_soap. You can read more about the configuration here but most likely you don’t need to do anything else.

$client = new SoapClient("http://localhost/SomeSoap.wsdl");
$something = $client->SomeFunction();

And that’s all.
If you get Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in the row of
$something = $client->SomeFunction();
your problem may be in your soap configuration or something like this.

No comments:

Popular Posts