Many simple interfaces are directly in the form of a URL,
How to call?
HttpClient Httpclient=null;
Postmethod Post=null;
try{
HttpClient = new HttpClient ();
Post = new Postmethod (Sendurl);
Setting the Encoding method
Post.getparams (). Setparameter (Httpmethodparams.http_content_charset, "GBK");
Adding parameters
Post.addparameter ("LoginName", LoginName);
Post.addparameter ("Password", Password);
Perform
Httpclient.executemethod (POST);
Interface return information
String info = new String (Post.getresponsebody (), CHARSET);
SYSTEM.OUT.PRINTLN (info);
}catch (Exception e) {
E.printstacktrace ();
}finally {
Close the connection and release the resource
Post.releaseconnection ();
((Simplehttpconnectionmanager) Httpclient.gethttpconnectionmanager ()). Shutdown ();
}
To this end, mainly to do their own memo, at the same time to facilitate the needs of people. Oh!
Java Invoke URL interface