[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 698
  • Last Modified:

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 ?
0
Crawler77
Asked:
Crawler77
  • 4
  • 2
1 Solution
 
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
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now