java - Logging in to site with Apache HttpComponents -


i'm trying login meetme.com can't figure out how it. i'm using httpcomponents apache. when run code below respose code of 200. have 2 part question.

1. how login www.meetme.com
2. let's user typed in incorrect password, how can know response if successful login?

import java.util.arraylist; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.message.basicnamevaluepair; import org.apache.http.namevaluepair;  class me {     private final string loginurl = "http://www.meetme.com";     private arraylist<namevaluepair> loginparameters;     httppost post;     httpclient client;      public me(){         try{             client = new defaulthttpclient();             setloginparameters();              post = new httppost(loginurl);             post.setentity(new urlencodedformentity(loginparameters));             httpresponse response = client.execute(post);              //how can know if login successful?             system.out.println(response.getstatusline());         }catch(exception e){             e.printstacktrace();         }     }      private void setloginparameters(){         loginparameters = new arraylist<namevaluepair>(1);         loginparameters.add(new basicnamevaluepair("username","username_here"));         loginparameters.add(new basicnamevaluepair("password","password_here"));         loginparameters.add(new basicnamevaluepair("quicklogin","1"));         loginparameters.add(new basicnamevaluepair("currentlocale","en-us"));     }      public static void main(string args[]){         new me();     } } 


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -