Solved

C++ Download Web page

Posted on 2008-06-24
3
1,141 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now