Wednesday, September 3, 2014

How To: Send HTTP POST Request in Java using Apache HttpClient

This example code shows how you can send data (or parameters) to a URL using POST. This is the complete program source code. The Apache HttpClient library simplifies handling HTTP requests. To use this library download the binaries with dependencies from http://hc.apache.org/ and add them to your project classpath. HttpClient class is used to retrieve and send data. An instance of this class can...

Tuesday, September 2, 2014

How To: Download contents of a URL in Java using HTTPClient

This Java function can be used to download a webpage into a StringBuilder instance using the HTTPClient class. You have to import the necessary libraries. public static String getURLContents(String url) {     HttpClient client = new DefaultHttpClient();     HttpGet request = new HttpGet(url);     StringBuffer str = new StringBuffer();       try {  ...

Monday, September 1, 2014

How To: Show Posts From Only Specific Categories on Your WordPress Homepage

Sometimes you'll need to show posts from only one category on your homepage. It's easy enough to do it. Following are the steps you need to follow: Find Your Category ID First you will have to find the ID of the category you want to show. When you're in the admin, hover over the edit link (or the title) for any of your categories and look at the address in your status-bar (that's the bar along...