Solved

C++ Download Web page

Posted on 2008-06-24
3
1,155 Views
Last Modified: 2008-06-25
I have had to make a switch from Visual Basic to C++. I need to make a console application (so no MFC) to download a webpage (just its contents works, too) and save it to a file on the hard drive. I am using Visual Studio 2008 and cannot find an answer via the MSDN.
0
Comment
Question by:ddbrown123
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 21859200
Take a look at libcurl, a free library for everything HTTP (and more) :

        http://curl.haxx.se/libcurl/

and more specifically this example :

        http://curl.haxx.se/lxr/source/docs/examples/simple.c
0
 
LVL 40

Accepted Solution

by:
evilrix earned 250 total points
ID: 21859866
The WinInet library, which is part of the Windows SDK (and part of the OS) contains all the functions you need to download a web page.

InternetOpen()
Initializes an application's use of the WinINet functions.
http://msdn.microsoft.com/en-us/library/aa385096(VS.85).aspx

InternetOpenUrl()
Opens a resource specified by a complete FTP, Gopher, or HTTP URL.
http://msdn.microsoft.com/en-us/library/aa385098(VS.85).aspx

InternetReadFile()
Reads data from a handle opened by the InternetOpenUrl
http://msdn.microsoft.com/en-us/library/aa385103(VS.85).aspx

InternetCloseHandle()
Closes a single Internet handle
http://msdn.microsoft.com/en-us/library/aa384350(VS.85).aspx
0
 
LVL 40

Expert Comment

by:evilrix
ID: 21859884
>> I need to make a console application (so no MFC) to download
You can write console applications using MFC. The Microsoft Foundation Classes aren't just about writing GUI applications.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question