views:

467

answers:

4
+1  Q: 

Download Web Page

How do i Download Web Page using C (not with libcurl), OS: Win32

Duplicate of Fetch Web Page in C [closed] and How to fetch HTML in C/C++.

+3  A: 

To download a web page, you need two things:

  1. Establish a communication channel with the websever
  2. Manage the web server protocol to download a page.

For the first item, have a look at the socket API. You need to open a socket, send some data using send(), receive data from the webserver.

For the second item, you need to understand the http protocol.

Bluebird75
+1  A: 

Try the wininet API

frankodwyer
A: 

What you need to do is called "socket communications". For an excellent overview, check out

http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_15.html

http://www.uwo.ca/its/doc/courses/notes/socket/

http://wiki.linuxquestions.org/wiki/Connecting_a_sockets_in_C

That last link is from linuxquestions, but both solutions are completely cross-platform, as opposed to frankodwyer's suggestion of wininet. That last link also does exactly what you want, in that it downloads a web page.

dj_segfault
A: 

You don't need anything ! Just use Win32 api (1 line of code !)

See Win32 api ng news://comp.os.ms-windows.programmer.win32 for code (C, C++)