I need to sent a HTTP GET Request to my site and then get the contents of the page and parse it. I’de prefer to not use libraries like libCURL because I want the end application to be fully independent (This is quoting from personal experience, I may be wrong but if I recall the client has to have certain Dynamic Link Libraries to run applications with libCURL libraries.), I’m using C++ in Visual Studio 2012.
Code examples would also be good.
When you don’t want to use an external library, you will have to implement HTTP yourself. When you only need the basic functionality (direct download of a file, no redirects, no proxies, no cookies, no authentication, no encryption, no compression, no other shenanigans), this isn’t even that hard.
Create a socket, connect it to port 80 of your webserver, and send the following strings to the server:
This requests the file http://www.example.com/example.html from the server you connected to.
The server will respond with an own HTTP response header followed by the data (or an error description).