Connect a web service in a php page
Connect a web service in a php page instantly lighten the SOAP in our mind as a first word when we talk about web service in php. In simple words if i explain it to you that how can you call this service or connect this service in your php page so you have to make it clear in your mind that you are communicating to a server. When you are communicating to a website or a server, being on web you have to follow the standards and for our convenience a language is introduced which we call XML. So one thing should be clear that response can or will come in XML format. Now, we have to check that what type of structure will that server follow, so it depends upon that query which you are sending as a request.
I am quoting a couple of examples here:
one of them is getting list of movies and other one is getting fotos.
But the difference comes here when we call these URLs or methods differentiate that how we send requests to the server. So the answer is:
PHP Function: SoapClient
The SoapClient class provides a client for » SOAP 1.1, » SOAP 1.2 servers. It can be used in WSDL or non-WSDL mode.
$client = new SoapClient(“http://www.centrina.com.br/WSConsumoPortal/Service.asmx?op=getListaImoveis”);
$result = $client-> //here you have to call your desired section from retrieved version of document.
As we got server response in $client so now you can go as much depth as you want by following the pointer ->1st->2nd->3rd level of depth.
I hope that you will like the article connect a web service in a php page. As i have written to just to give a little introduction about SoapClient. I will further write it in details, for beginners it is enough to get rid of fear of SOAP, i hope.
Last updated: March 19, 2014