Updated code to use httpclient instead of commons-httpclient