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.
Related
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/
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
I'm not sure if this is even possible, but I figured this was a great place to ask the question.
I'm using http://simpletest.org/en/browser_documentation.html PHP WebBrowser to test a wordpress site. What I'm doing is setting the login credentials to access the wordpress backend. I run a couple of test, but my question is in certain situations I want to transfer the session that the "SimpleTest PHP Web Browser" has running to client's browser. Aka... my browser.
So in a since I"m transferring the session from the server side test browser to a normal client browser. This "client browser" is the same browser that is literally running the SimpleTest script to begin with.
I'm wondering if I can transfer the header & cookies associated with the "SimpleTest PHP Web Browser" to my browser. What I'm thinking is to pull the data out using the SimpleTest PHP Library and then set that information to the client browser using Javascript.
Is this even possible? I feel like I'm missing some basic understanding of server side session authentication which would make this impossible.
Any ideas? I'm really curious!
Did you look at the Authentication documentation for SimpleTest?
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.
Im wondering what affect loading an external page with php has on a sites analytics. If php is loading an external page, and not an actual browser, will the javascript that reports back to google analytics register the page load as a hit?
Any JavaScript within the fetched page will not be run and therefore have no effect on analytics. The reason for this is that the fetched HTML page is never parsed in an actual browser, therefore, no JavaScript is executed.
Curl will not automatically download JavaScript files the HTML refers to. So unless you explicitly download the Google Analytics JavaScript file, Google won't detect the Curl hit.
Google offers a non-JavaScript method of tracking hits. It's intended for mobile sites, but may be repurposable for your needs.
You're misunderstanding how curl/file_get_contents work. They're executed on the server, not on the client browser. As far as Google and any regular user is concerned, they'll see the output of those calls, not the calls themselves.
e.g.
client requests page from server A
server A requests page from server B
server B replies with page data to server A
server A accepts page data from server B
server A sends page data to client
Assuming that all the requests work properly and don't issue any warnings/errors and there's no network glitches between server A and server B, then there is absolutely no way for the client to see exactly what server A's doing. It could be sending a local file. It could be executing a local script and send its output. It could be offshoring the request to a server in India which does the hard work and then simply claims the credit for it, etc...
Now, you CAN get the client to talk to server B directly. You could have server A spit out an HTML page that contains an iframe, image tag, script tag, css file, etc... that points to server B. But that's no longer transparent to the client - you're explicitly telling the client "hey, go over there for this content".