How do i Download Web Page using C (not with libcurl), OS: Win32
Asked
Active
Viewed 5,995 times
3 Answers
4
To download a web page, you need two things:
- Establish a communication channel with the websever
- 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.

Philippe F
- 11,776
- 5
- 29
- 30
1
What you need to do is called "socket communications". For an excellent overview, check out
http://web.archive.org/web/20090402133256/http://www.uwo.ca/its/doc/courses/notes/socket/
http://wiki.linuxquestions.org/wiki/Connecting_a_socket_in_C
That last link is from linuxquestions, but both solutions are completely cross-platform, as opposed to frankodwyer's suggestion of wininet. The last link also does exactly what you want, in that it downloads a web page.

joe_young
- 4,107
- 2
- 27
- 38

dj_segfault
- 11,957
- 4
- 29
- 37
-
Thanks for dinging me a point, unixman83. I'll be sure and return the favor at some point. You must care a whole lot more than the OP since he asked this question THREE YEARS AGO and didn't select an anser. – dj_segfault Apr 13 '12 at 21:50