Search code examples
phpsoapsoapserver

SOAP url in browser


When you enter soap servers url in browser, normally it produces blank page. But if memory serves me I saw somewhere something like

Hello, this is our soap service. For documentation please follow this link. To get an account, please follow this link. Blahblah.

How can I do that? (Using PHP SoapServer, if that matters).

I did try to just print everything at the bottom of soap-server-handling php code but in that case soap server doesnt work when called from proper soap client.


Solution

  • The example you saw doing that was probably checking for one or more things in the headers and acting upon what it saw. For example, it could inspect

    USER_AGENT
    ACCEPT
    ACCEPT_ENCODING
    

    etc, etc, etc.

    For you to do this in PHP, you will need your check to be run before your SoapServer gets the request. You can access the header values by inspecting $SERVER. Most of them will start with HTTP. To get started just

    print_r($_SERVER);