There's a very light way and I've done this myself when implementing a high-scale back end service for a large media provider in the UK.
This method is extremely operating-system specific.
- open a TCP socket to the HTTP server
- send a "
GET /path/to/url HTTP/1.1\r\nHost: www.host.com\r\n\r\n
" (the Host
header is required for HTTP/1.1 and most virtual servers, don't forget the two blank lines, and a newline requires a carriage return as well for HTTP headers)
- wait for the response
- close the socket
If you are going to close the socket at the end of the connection you may also want to send a Connection: close\r\n
as part of your headers to inform the web server that you will terminate the connection after retrieving the web page.
You may run into trouble if you're fetching an encoded or generated web page in which case you'll have to add logic to interpret the fetched data.