Reading HTTP packages to use with Winhttp

How can I read the HTTP packages that my browser send ?
(For example when I login to a site)
And can I use that info to use with winhhtp in VBA ?
Crawler77Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

InderjeetjaggiCommented:
YOu will heva to use a packet sniffing software to do so

have a look at below website:
http://en.wikipedia.org/wiki/Packet_sniffing
0
Crawler77Author Commented:
Can I do it from VBA using an Internet Explorer Reference ?
0
PaulHewsCommented:
Fiddler is a tool specifically geared towards debugging HTTP requests.  It will work with your VBA wininet

http://www.fiddler2.com/fiddler2/

Packet sniffing will work also, but only gives you the "raw" requests and responses.  Fiddler will work with compressed HTTP and works well separating/interpreting all the different requests made by the browser.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Crawler77Author Commented:
Thanks Paul.

It seems to be the tool that I'm looking for. But I've encountered an interesting problem. The application runs smoothly on my home computer (which is running Vista), but not running properly on the work computer (which is running XP). I don't know the reason yet. So it will take some time to see if this solution works for me or not.

One of the other setbacks of the program (and also my code) is that it sends the http requests bypassing the browser (which is in fact an expected situation). So when you try to see the result in the browser, browser sends another request and it usually changes the previous one. So it's hard to test the code, and see the result. Do you have any idea on this ?
0
PaulHewsCommented:
Fiddler acts as a proxy, so you might have to set up the proxy settings for your http access.  Fiddler is configured to listen on port 8888 by default.

If you are using winhttp you can do this like so:
Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0
Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0
Const HTTPREQUEST_PROXYSETTING_DIRECT = 1
Const HTTPREQUEST_PROXYSETTING_PROXY = 2

Dim http As WinHttpRequest
Set http = New WinHttpRequest

http.SetProxy HTTPREQUEST_PROXYSETTING_PROXY, "localhost:8888"
http.Open "GET", Url, False
http.Send
MsgBox http.ResponseText

Open in new window

0
Crawler77Author Commented:
This nice app partially solved my problem but I would be happy if it also had a VBA refence to use in my code. Anyway thanks for the help...
0
Crawler77Author Commented:
When I copied http requests from fiddler to my app source code it did not always work.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.