iphone4life4
iphone4life4

Reputation: 57

Read webpage and store in string without using libcurl. (C++)

What I want to do is read a webpage and then store it in a sting I know how to do this using libcurl but is there any other way to do this without using libcurl?(Using Cygwin to compile)

Upvotes: 0

Views: 294

Answers (3)

Andrew
Andrew

Reputation: 66

While you can easily create an HTTP client using raw sockets as the other posters have suggested, I recommend against it if you want to deploy your software anywhere outside of your own computer. In the real world your users are likely to be behind proxies and firewalls, and may require authentication. Libraries like libCurl deal with this complexity for you.

If you really can't use libCurl and don't care about cross-platform code, most operating systems have built in APIs for accessing web pages. WinINET is the Windows library.

Upvotes: 1

orlp
orlp

Reputation: 117916

You can implement a simple HTTP request using raw sockets. But for other than learning exercises I would not recommend this and just go with libcurl.

For an example program which uses raw sockets look here: http://coding.debuntu.org/c-linux-socket-programming-tcp-simple-http-client (randomly found on google, quality not assured).

Upvotes: 1

Ken Bloom
Ken Bloom

Reputation: 58810

You can always speak HTTP directly yourself over a socket.

Upvotes: 0

Related Questions