Or you can do it the simple way:
try {
URL url = new URL("http://www.yourURL.com/login.php");
HttpURLConnection con =(HttpURLConnection) url.openConnection();
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
DataOutputStream printout = new DataOutputStream(con.getOutputStream());
// This is the POST
String content ="
[email protected]&pass=577383";
printout.writeBytes(content);
printout.flush();
printout.close();
DataInputStream input = new DataInputStream(con.getInputStream());
String str;
//Read the response
while (null != ((str = input.readLine()))) {
System.out.println(str);
}
input.close();
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
This is described in more details on
http://www.gulany.com/?page_id=7 [ May 07, 2007: Message edited by: jad yuuu ]