Webpage source code

Hello Everyone!

I've managed to download a "file" from the internet with the help of wininet library, but I can't seem to save a "webpage" i.e. something I can edit later on with a text editor or with ifstream, for not all webpages end with the .html extension.

In this case, what are the tools I should resort to? Can wininet save a webpage to disk? Should I consider cURL (though I haven't managed to download regular files due to lack of documentation of cURL)? Do I need to learn what's called socket programming?

NB: I'm on Windows, using MinGW but can switch to MSVC if necessary, I'm looking for source code in the webpage, eventually I'm after the text in a webpage.

Any help is greatly appreciated!
Last edited on
I'm pretty sure that if you connect to a web page via http the first thing it does it send you its source.
Dear gpotw,

I don't think you understood my point: how to connect to a webpage in the first place.

Thanks for your time...
Apologies. The last time I did any network/internet programming was long ago using VB6 and the winsock control. Is there a reason you can't specify the page itself as the resource to download? Most communication with http is simply requesting resources at different URLs and downloading them.
I am not sure which functions do you use, but if you use the InternetReadFile function for example, you can read the web page source file to a buffer, then save it to the disk and do whatever you want with it?
Topic archived. No new replies allowed.