I need your help please.
I'm developing a java application using restfb library, in which i want to get all the facebook users who liked my fan page on fb. I worked for many days to do that but i didn't find a solution.
I wrote this code but it return the number of likers only:
FacebookClient fb= new DefaultFacebookClient("ACCESS_TOKEN");
Page page = fb.fetchObject("PAGE_ID", Page.class);
System.out.println("My pages likes: " + page.getLikes());
Note that i'm getting the ACCESS_TOKEN from the Graph API Explorer when i'm logged in on the fb page, because i didn't find a way to get the token from java code. So when i logout i sea this error:
Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: Error validating access token: The session is invalid because the user logged out.
at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:766)
at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:688)
at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:630)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:592)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:556)
at com.restfb.DefaultFacebookClient.fetchObject(DefaultFacebookClient.java:244)
at testrestfb.testfb.main(testfb.java:95)
Please help me to solve this problem..
Thanks in advance.