HTTP is a complex protocol and hence softwares called browsers are created to make HTTP request and understand the response.
If you use firefox and use plugins like httpfox (google for it), it will tell you what goes "behind the scenes" whenever an HTTP request is made. In many cases one HTTP request gets converted into a chit-chat between browser and server that spans over multiple request-responses. eg: in your case when you type
http://www.google.com it returns an HTTP code 302 that tells that you need to instead query another URL
http://www.google.co.in. Your browser does all this behind the scenes for you.
If you plan to write a browser like code then it is a big exercise and it may be worth looking at apache HTTPClient (google for details) before writing something of your own.