Using java Syntax Highlighting
- public static InputStream getInputStreamFromUrl(String url) {
- InputStream content = null;
- try {
- HttpClient httpclient = new DefaultHttpClient();
- HttpPost httpPost = new HttpPost(url);
- List nameValuePairs = new ArrayList(1);
- //this is where you add your data to the post method
- nameValuePairs.add(new BasicNameValuePair(
- "name", "anthony"));
- httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
- // Execute HTTP Post Request
- HttpResponse response = httpclient.execute(httpPost);
- content = response.getEntity().getContent();
- return content;
- }
- }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

