SOAP url in browser - php

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.

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);

What you want to do is look into WSDL (Web Service Description Language). Languages like .NET produce them for you.

Related

How can I view my HTTP or HTTPS request before I send it?

I'm in the process of trying to better understand http, more specifically I want to get comfortable working with web based APIs. Some of the documentation I've read for specific API's mention that the API will expect to get an http request in exactly this format, with specific headers and content.
I'm trying to use php cURL, but googling around I haven't found a way (that I understand) simply print my http request to the screen or a text file rather than sending it. I want to make sure that the request I'm constructing looks how I intend it to, rather than just getting back a success or failure message from whatever server the request is sent to. Is there an easy way to do this?
You should try using Fiddler. Fiddler show RESPONSE and REQUEST HEADER. Other than that you can install some extension to your browser that shows HEADER, Firefox does have such extension I think it is called LiveHTTP... sorry didn't remember name.
For web debugging Fiddler is what you need http://fiddler2.com/

Using phonegap, is there a way for an Android device to communicate with PHP?

I have a php page which connects an API and gets information back which can then be displayed.
I'd like to turn this into an app for Android. I've heard of PhoneGap, which I know uses javascript, html, and css. I know javascript is capable of calling php files, but I am unsure how or if its even possible to call a php file from an android device. I'm not sure if android browsers can handle php, or what the deal is with them. So if you have any information on that, I'd appreciate it.
I'm also willing to rewrite the API call in javascript, but I don't think thats possible. If you think differently, please let me know what you're talking about.
Android cannot talk directly to PHP. What phonegap, javascript, etc.. are doing is simply issuing HTTP requests that happen to be handled by a PHP script.
The PHP code will execute, output some data (json, html, xml, gif, jpg, etc...) and send that out as a the HTTP request's reply.
PHP is just a server side language so it doesn't matter if your browser "can or cannot" handle it, only HTML is returned (unless you set a different content-type).
You may be worth while looking into REST style JSON api's which would allow a XMLRequest to be sent to. Have a look at this document
Theres also a nice tutorial here which shows how to call a REST API and a PHP Tutorial here to create a REST API.
1.It dosent matter to PhoneGap where the PHP is hosted or Its PHP OR ASP.NET OR ASP.NET MVC
2.If You wanna host your PHP code yourself in production (You mayb shouldn't do this in production). then you need a server and a static IP address
3.if you just wanna setup a PHP server for developmental purposes then just tie it to 127.0.0.1:81 and you can directly use this address it doesn't matter whether you have a static IP address or not.
I have done this with phonegap using jsonp
http://en.wikipedia.org/wiki/JSONP
Works great

Querying A Server And Receiving XML Responses In PHP

I'm trying to write an API for a website, whose Flash app gets data from a server and presents it to the user. I've been told that I can "have a look web trafic you will the responses from the server are all just basic xml".
This might be the wrong question to ask but, I'm not entirely sure what I've been told to do here. Can I simply use PHP to open the page with the Flash app on, and intercept the XML responses being sent to it? How might that happen?
Alternatively, am I coming at this the wrong way? Do I need to instead know what server the Flash app is accessing, and then open up a connection to that?
This feels like a bad SO question, but I'm at a complete loss. The advice I was given was quite vague so I don't know where to look.
To see the server response in the web traffic, just use the "Net" tab of the firebug plugin of firefox.
It should display the request of the flash app with the response from the server which should be in XML.
EDIT
You will also know with firebug from which URL the response is coming from and you can then mimic the request of the flash app with your own php script.

How do I debug a webhook POST?

A webhook is sending me a POST, and I want to do some debugging on it. Currently I'm looping over the array and then sending a mail() to myself instead of printing (because how could I see what's printed to the page?), but I'm betting there's a more efficient way.
Any suggestions?
https://requestbin.com/ lets you create a temporary URL that will show you all the HTTP request data sent to it.
There are multiple options for debugging:
Use a debugger with an IDE, like netbeans. This will run the application and figure out where things are going wrong.
Use logfiles of your server, or generated by application exceptions
Collect your debug information with a buffer and put it in a file in your public directory. Overwrite with every new request.
I know this is quite an old question but if you want to see what kind of responses you are going to get from webhooks or you need to need to access the developer environment then there are a selection of tools that can help you.
RequestBin is probably one of the simplest to use by, providing a unique URL that you can then set this as your endpoint for Event notifications. Using this URL you can check to see what responses you are receiving.
You can generate a unique URL by creating a RequestBin.
An Example URL is this:
http://requestb.in/XXXXXXXX
This will be used to receive Event Notification Data and Receive Inbound Parse Data.
The results will then be found by heading to your RequestBin unique URL.
Ngork is also a tool that is useful for creating a local tunnel to your machine. This makes testing webhooks locally easy.
To setup install and enter the following in your CLI (after signing up first):
$ ngork 3000
This would open a connection to the port 3000 that is on your local machine, then at a URL you can put your URL for your PARSE Webhook or Event Webhook.
$ ngrok -subdomain=myappname 3000
Runscope is a tool for debugging APIs. It acts as a proxy, collecting all data sent to it and passes it on to another point. You may then, later, review what was sent to the API you’re debugging.
Source : https://sendgrid.com/docs/API_Reference/Webhooks/debug.html
http://httpresponder.com/ works also, and lets you configure a canned response if you need one.
You can use https://www.reliablewebhook.com/. They also have a plugin for Visual Studio Code for local debugging.

Access to content disposition header in php/server

I am doing some debugging in php and I need to take a look at the full headers sent to the server in including the multipart form-data information stored in content disposition.
However apache_request_headers() doesn't return that information.
Any clues?
I am also happy to look at a non php solution if possible
From PHP Docs:
Note: As of PHP 4.3.3 you can use this
function with the NSAPI server module
in Netscape/iPlanet/SunONE webservers,
too.
Make sure that those requirements are met.
You can also get the complete header info with feature-rich httpWatch program out there.
Also not PHP related, but you can see the complete request header along with the responses in any Webkit browser (Safari, Chrome) via the Resources-tab in the developer tool. And for Firefox, there's the FireBug-addon, which offers the same functionality.

Categories