I'm pretty new to C++, however am reasonably experienced with PHP and Expression 2 (Garrys Mod code language).
I am most interested in making things web related, and have found libcurl which seems to be a good function library. I now know how to get pages/send POST forms after a bit of research.
My question is:
Programs like Tor run on your PC and handle web requests from the browser. You point your browser at your local host, with a specific port number.
1) How does this work? At a guess I'm going to say sockets, yay or nay? If so, how? If not - forget that.
My mental image of the rough route:
Browser -> Program -> Server (PHP) -> *Gets web page* -> Server (PHP) -> Program -> Browser -> *Displays*
This anything like correct?
2) How might I go about doing this myself? I don't want to do any encrypting or anything snazzy like multiple servers, however, I'd like to be able to handle a request for say... google.com.
I presume I'll be sending the requests to a PHP script which will then get the data required and send it back? If so, a quick point in the right direction would be great!
This might be a bit of a hard question to answer (maybe?), however any information would be excellent and much appreciated.
First of all I'd like to say as a human being, I've always appreciated your great height and also the cooling abilities of your leaves.
OK - Enough funny bidness. All requests to and from the Web are using socket calls at some level. Sometimes you might have access to a nice library of code that hides the sockets part from you, but sockets are being used.
To do it yourself, find some great books, like UNIX Network Programming - Third Addition; also use Google; and the PHP Website has great resources on how to get started. When I needed to do some PHP for a client, I started at the PHP Website and that helped me very much!
EDIT: I've now found an excellent tutorial/example on winsock2.
Its shown me how to set up a socket server and client, however, I'm not interested in the client side of things as this will be the browser.
I'm now receiving the request from the browser, which I can use to get the page with libcurl/PHP.
My question now is, how do I send this back to the browser? I presume it follows a protocol and I'll need to send various things before the actual HTML/headers. Is there a reference sheet or protocol listing somewhere?