Solved

C++ Download Web page

Posted on 2008-06-24
3
1,159 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

734 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