-
Grabbing HTML
Hello,
Im new to C/C++ and Im not sure how to approch this,
At work every so often I need to review a log file displayed to me in an html table, and look through it for certain things, however this log is not sorted! (and I do not have any access to the server).
I would like to save myself some time, and make a small program to download the file, sort it, and display what is relevant to me in the correct order.
Sorting it is straight forward if I can get it into a string, but how do I download/grab the html?
Im not really sure exactly what Im looking for here, and my searching hasn't been very rewarding as a result.
Do you know of any straight forward ways to approch this?
(Any url's or tiny examples much appreciated!)
-
You require sockets/network programming.
A good tutorial exists here:
http://www.ecst.csuchico.edu/~beej/guide/net/
For windows specific(WINSOCK) you can read this:
http://www.hal-pc.org/~johnnie2/winsock.html
Windows specific again, higher level programming interfaces exist such as:
http://msdn.microsoft.com/library/de...classtopic.asp
(requires .NET framework)
In summary, google for "network programming" "socket programming" "winsock".
Goodluck
-
wget (or another URL grabbing tool of your choice - there are several) to get the HTML
perl to munch the file looking for things which interest you.
Doing the whole thing in C++ would be tedious, unless that's the whole point of the exercise (learning).
-
Thank you!, my mistake was assuming there would be an easier way then sockets.
For future reference if anyone wants to do this, I have found the easiest way to be following Salems advice and using WGET to fetch the html, so it can then be processed locally.
There is a windows port of WGET with C source here: http://www.interlog.com/~tcharron/wgetwin.html