0

How do I programatically get internet traffic from a web site in C# or C++?

I mean, how can this be done without opening up a browser or a broswer control?

Additionally, there is some sort of plugin to a browser in IE and others where you can watch the communication from a browser to a server and back. Does anyone know about this?

Termininja
  • 6,620
  • 12
  • 48
  • 49
xarzu
  • 8,657
  • 40
  • 108
  • 160
  • 1
    When you say "get internet traffic," do you mean "make HTTP requests to the web server" or "determine how many people are visiting a site?" – templatetypedef Jan 18 '11 at 06:47
  • 1
    Wow, that's broad. There are so many HTTP libraries out there it isn't funny. I think you need to look for an introduction to network programming, and then look into the many available HTTP (and HTML) libraries out there. – derobert Jan 18 '11 at 06:54
  • + This is a duplicate :: http://stackoverflow.com/q/4721236/482864 – soulseekah Jan 18 '11 at 06:59
  • possible duplicate of [How cam I programatically get internet traffic from a web site in C# or C++?](http://stackoverflow.com/questions/4721244/how-cam-i-programatically-get-internet-traffic-from-a-web-site-in-c-or-c) – derobert Jan 18 '11 at 07:03
  • 1
    @Soulseekah: Hopefully can mark the other as a duplicate. This one has more answers... And for that matter, I believe you can flag for mod attention duplicate. – derobert Jan 18 '11 at 07:04
  • 1
    Jeez, why did you ask this TWICE and accept two different answers? I should merge, but then the person you selected as the answer in the other question would lose points... –  Jan 18 '11 at 14:24
  • Sorry, I did not know I added this twice. I would think you could merge and still keep the points. Our just remove the other post but keep the points. – xarzu Jan 19 '11 at 18:14

5 Answers5

2

If you are looking for programmaticaly requesting web pages then you might check httpwebrequest in C#.

Additionally, there is some sort of plugin to a browser in IE and others where you can watch the communication from a browser to a server and back. Does anyone know about this?

you can check fiddler.

Biswanath
  • 9,075
  • 12
  • 44
  • 58
2

Look into cURL for C++ http://curlpp.org/ or if you want more low-level communication processing check socket programming and winsock. You'll connect to a server on a port and send a GET request, the server will respond with the HTML code if the page is an HTML, etc.

You will have to have some basic HTTP protocol knowledge though. http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

Anthony Pegram
  • 123,721
  • 27
  • 225
  • 246
soulseekah
  • 8,770
  • 3
  • 53
  • 58
1

Use the WebClient.DownloadString() or DownloadStringAsync() with the address of the web site.

Michael S. Scherotter
  • 10,715
  • 3
  • 34
  • 57
0

WebClient and HttpWebRequest can be used to communicated with servers without a browser

http://msdn.microsoft.com/en-au/library/system.net.webclient(VS.80).aspx

http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx

Fiddler can be used to watch the browser communication

http://www.fiddler2.com/fiddler2/version.asp

djeeg
  • 6,685
  • 3
  • 25
  • 28
0

You can use System.Net.HttpWebRequest, which lets you send http get and http post requests.

Stefan Steiger
  • 78,642
  • 66
  • 377
  • 442