Hi All,

I am login to facebook site using httpclient, it logs in 70% of times but
fails 30% of time, i am not able to find the solution, any help would be
greatly appreciated.

The problem with the code is 
1)some time it logs in and redirect to home.php
2)some time login fails.

is there any thing i am not adding. 

the code i used to connect is 

        /**
         * @param args
         */
        public static void main(String[] args) {
                // TODO Auto-generated method stub

                HttpClient httpclient = new HttpClient(); 
                
                httpclient.getHostConfiguration().setProxy("10.30.250.4", 8080);
                try
                {
                   HttpMethod httpMethod = new
GetMethod("http://www.facebook.com/login.php";); 
                   //httpget("http://www.facebook.com/login.php";); 
                 
                httpclient.executeMethod(httpMethod);
                int statuscode = httpMethod.getStatusCode();

                         String date = "2011" + "/" + "01" + "/" + "01";
                     java.util.Date utilDate = null;

                      SimpleDateFormat formatter = new 
SimpleDateFormat("yyyy/MM/dd");
                      utilDate = formatter.parse(date);
                      

            HttpMethod httpPost = new
PostMethod("http://www.facebook.com/login.php";);
            NameValuePair[] nv=new NameValuePair[2];; 
                nv[0] = new NameValuePair("email", "************************"); 
                nv[1] = new NameValuePair("pass", "************************"); 
                ((PostMethod)httpPost).setRequestBody(nv);
                
                httpclient.executeMethod(httpPost);
                int statuscode1 = httpPost.getStatusCode();
                
                
        Header locationHeader = httpPost.getResponseHeader("location");
        String redirectLocation="";
        if (locationHeader != null) 
        {
                redirectLocation = locationHeader.getValue(); 

        }       
                 System.out.println("redirect location"+redirectLocation); 

                httpMethod.releaseConnection();
            httpPost.releaseConnection();
                
                } catch(Exception e){
             e.printStackTrace();
                } 
        }


any help would be appreciated

-- 
View this message in context: 
http://old.nabble.com/Facebook-login-fails-tp29854635p29854635.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to