views:

112

answers:

1

When I Get "https://login.facebook.com" by using Chrome, the response is 302 and redirect me to http://www.facebook.com. However, when I get "https://login.facebook.com" by using HttpClient's GetMethod, it will be blocked for a long time and finally throws a Timeout Exception.

I feel really frustrating. Is the implementation of Sun JDK's SSL which HttpClient is based on not compatible with facebook's login server?

Can any one tell me what should I do to connect https://login.facebook.com by using HttpClient.

A: 

You should use the facebook api for java for doing so. I think they block requests like yours, since they have made an api for developers to log in through.

You need to join the facebook developers group and create an application so you can get an API key. Se link below for more information.

Download it here

Jes
Jes, I just want to connect login.facebook.com and get the response. Facebook login server can not distinguish between a browser and my HttpClient application if the same request headers are sent.And the problem is that Facebook login server just does not accept my application's request but Chrome's.
James
It could be the referer and/or other request headers are different than the browsers. The login server probably checks the referer and client.
Jes