Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write code to access Web Services in PHP

Status
Not open for further replies.

ehx6

IS-IT--Management
May 20, 2004
150
US
hi,
I need to write a one page PHP in which it connect to a server that provides me xml file. The xml provider asked me to connect by coding the header of my page . I am not sure what he ment by that and I have not done such thing. Kindly, if you have a sample code to show me how to set up my PHP page to connect to an xml service provider so I can get an xml file to show the return data in a grid to the user.
thanks
ehx
 
Web services usually are acces with a specific protocol, such as SOAP. There are several SOAP classes out there that will do the work for you.
Here's how it works in principle:
Your PHP application opens a route to the server (usually a TCP/IP socket connection).
The it sends out a string that is formatted in a specific way, the header.
The receiving server will examine the header and if recognized process the embedded request.
A result is sent back.
Your PHP application - which has been waiting for the response - examines the response and takes appropriate action. These actions depend on what the returned content was, e.g. an error or the actual data.
Have you googled for 'PHP web services SOAP'?
 
Thanks for your reply, however, I would like to know how to code the header, Do you have a sample code for the header to access web service.
thanks
Ehx
 
The answer really depends on what kind of potocol is to be used. WSDL? RPC? SOAP? HTTP?
WHat did the provider ask for? WHat is the service?
 
Thanks DRJ478,
The provider asked me to use HTTP and he provided me with long strings for authorincation to be put in the header of the page.

If you have some sample code for such code, I would apprecited.
thanks
Ehx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top