Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String getJSONResponseFromURL(String url, Hashtable<String, String> httpGetParams){
- String json_string="";
- List<NameValuePair> nvps=buildNameValuePair(httpGetParams);
- url=buildGetUrl(nvps,url);
- System.out.println("URL==>"+url);
- InputStream is = null;
- try{
- HttpGet httpget = new HttpGet(url);
- HttpResponse response = getThreadSafeClient().execute(httpget);
- HttpEntity entity = response.getEntity();
- is = entity.getContent();
- BufferedReader reader=new BufferedReader(new InputStreamReader(is),8192);
- String line=null;
- while((line=reader.readLine())!=null) {json_string=json_string+line;}
- response.getEntity().consumeContent();
- System.out.println("Json Response==>"+json_string);
- }catch(Exception e){
- return null;
- }
- return json_string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement