public static String getStringFromUrl ( String urlString ) { ApacheHttpClient lclient = ApacheHttpClient . create ( ) ; WebResource webResource = lclient . resource ( urlString ) ; ClientResponse response = webResource . get ( ClientResponse . class ) ; if ( response . getStatus ( ) != 200 ) { throw new RuntimeException ( "HTTP error code : " + response . getStatus ( ) ) ; } String result = response . getEntity ( String . class ) ; return result ; }
get a String from a given URL