tags:

views:

87

answers:

2

Is there a good, simple library which allows C++ to load a webpage? I just want to grab the source as text. I'm not using any IDE or significant library, just straight command line.

Tangentially, is there something fundamental I'm missing about programming in C++? I would think any language in common use today would have droves of web-based functionality, being so central to computer usage, but I can find next to no discussion on how to accomplish it. I realise C++ significantly predates the modern internet, so it lacking any core ability in the regard is reasonable, but the fact that relevant libraries seem so sparse is baffling.

Thanks for your help.

+7  A: 

Sure, for example libcurl is powerful and popular.

Internet-related libraries for C++ are extremely abundant -- they're just not part of the C++ standard, partly because the current version of that standard is so old, though I'm sure that's not the only reason. But turn to the world of open sources and you'll find more than you can shake a stick at.

Alex Martelli
I would say it's primarily missing frim the std. lib for the same reason threads, GUIs, DBs, and all net stuff is missing: std C++ has to be able to run in an environment that doesn't have any of those things (incl. "unhosted" environments).
Drew Hall
I think it's politics at the Standards committee. I think it's that desire to reach perfection and consensus that bears this insane, painful cost of time -- lots of time -- before each standard.
wilhelmtell
@Drew, "unhosted" environments are allowed to be missing many parts of the standard library, such as e.g. file streams, so that's not a sensible reason for missing other parts that might be similarly omitted by "not fully hosted" environments.
Alex Martelli
+2  A: 

libcurl is a popular C library for fetching HTTP and other URLs. There's also cURLpp a C++ binding .

On Windows you have the WinINet and WinHTTP APIs.

I think HTTP is a bit too complex to be part of the C++ Standard Library. The specification would have to take a lot of details into account such as proxy servers and MIME types.

Alexandre Jasmin