public void Post(String url)
{
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(url);
method.addParameter("q","italy");//the site i was testing was a search site
method.addParameter("submit","go!");//the go button
int statusCode = client.executeMethod( method );//executes and send the information
if( statusCode != -1 )
{
String contents = method.getResponseBodyAsString();
System.out.println(contents);
method.releaseConnection();
}
}
The main problem is that i need to access sites that use the "Get method" as well, however i cannot seem to find a good tutorial on this and when i do, it never seems to work correctly. And on top of it (to add to my confusion), the GetMethod() from Apache doesn't seem to have an .addParameter() feature for me to pass parameters to IE: "search","Italy". Any information would be greatly appreciated and thanks for viewing!

New Topic/Question
Reply




MultiQuote





|