Code example for UrlEncodedFormEntity

0
    		nameValuePairs.add(new BasicNameValuePair("quest", query));
 
    		//Set http header 
    		post.setHeader("Content-type", "application/x-www-form-urlencoded");
    		post.setHeader("Accept", "text/plain");
    		post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    		HttpResponse response;
    		response = client.execute(post);
    		return "string"; 
 
    	} catch (ClientProtocolException e){
    		e.printStackTrace();
    		return "Error CPE"; 
    	} catch (IOException e){
    		e.printStackTrace();
    		return e.getMessage();
    	} 
 
 
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE