views:

420

answers:

2

How do I capture HTTP response when the request is made by web browser?

Webpage retrieves data (with post) from a service. Service returns a json object. What I want is to capture that json and parse it in realtime.

What would be the simplest way to do it?

+1  A: 

Your best bet is to use Fiddler, perhaps with the JSON viewer add-on.

From the homepage:

Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP(S) traffic, set breakpoints, and "fiddle" with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Dave Van den Eynde
"capture that json and parse it in realtime" - s/he needs a programmatic solution, not a one-shot data
Dercsár
But, as the description says, Fiddler can be extended using any .NET language. You could, for example, develop a plugin that does what you need, without having to write your own HTTP proxy (or packet capture tool).
Dave Van den Eynde
A: 

Try googling for HttpModule in .Net. They are some sort of filters. HTTP requests and responses flow through them and can manipulate the content.

Dercsár
He/she needs a client-side solution.
Dave Van den Eynde