views:

1143

answers:

7

I'm looking for a C++ library that implements or enables the implementation of a HTTP client. It should handle cookies as well.
What would you propose?

Thank you in advance for your time.

+7  A: 
dfa
+8  A: 

Curl++ is an option, particularly if you want things in more of a C++ style.

bdonlan
broken link (15 chars)
Assaf Lavie
+5  A: 

C++ (STL) does not have a HTTP or network library by default, you will have to do with something else.

libcurl should do what you want. cURL++ is the same libcurl wrapped in a shiny C++ wrapper.

The Unknown
A: 

On Windows you can drive IE using IWebBrowser2 interface.

eed3si9n
+1  A: 

If it's for windows, take a look at Windows HTTP Services (WinHTTP)

http://msdn.microsoft.com/en-us/library/aa384273(VS.85).aspx

Microsoft Windows HTTP Services (WinHTTP) provides developers with an HTTP client application programming interface (API) to send requests through the HTTP protocol to other HTTP servers.

WinHTTP offers both a C/C++ application programming interface (API) and a Component Object Model (COM) automation component suitable for use in Active Server Pages (ASP) based applications.

For Cookies http://msdn.microsoft.com/en-us/library/aa383261(VS.85).aspx

Thanks for your suggestion. It's plain C without any of C++ there. I'd really like to make use of Bjarne's hard work (http://research.att.com/~bs).It should be forbidden for a couple of years now to use C in application programming :)
Piotr Dobrogost
+1  A: 

You can try WinInet

http://msdn.microsoft.com/en-us/library/aa385331(VS.85).aspx

In contrast to WinHTTP, it's more client-side oriented.

Eugene
Piotr Dobrogost
You can also look at URL monikers:http://msdn.microsoft.com/en-us/library/ms774965(VS.85).aspx, it relies on WinInet(as I think), but provides COM like interface.
Eugene
@Piotr: trust me, if you think WinHTTP is bad, you will absolutely *HATE* WinInet... It is an astonishingly unfriendly API, even if you're used to working with C libraries. And the worst part of it may be the WinInet constants and errors that "bleed through" to higher-level libraries such as MSXML... The big advantage of WinInet is that if a user has already configured proxy settings for their account (via the administrator options or the IE / Internet Options control panel) then WinInet will pick those up automatically; other libraries may need explicit configuration. Windows-only though...
Shog9
+4  A: 

Take a look at Poco Libraries.

I started using them as they are portable and it's a joy to work with. Simple and clean - though I haven't dived in anything fancy for the moment.

da_m_n
Poco is a very nice library that in my opinion deserves more publicity than it seems to get
John Burton