0

I'm getting an java.net.unknownhostexception while accessing the URL but i'm able to access through browser.

      public static void main(String[] args) throws IOException, JSONException`enter code here`
{
JSONObject json = readJsonFromUrl("https://graph.facebook.com/page_id/?
access_token=xxxxx&fields=name,likes,posts");
System.out.println(json.toString());
System.out.println(json.get("likes"));
}
harish
  • 143
  • 3
  • 10

1 Answers1

1

The request URL you're using is not valid. In your request URL, change page_id to the actual Facebook page id you are trying to request data for, and include the API version you are working with.

E.g. if I wanted to access a page with the id 3454546 -

https://graph.facebook.com/v2.9/3454546?access_token=xxxxx&fields=name,likes,posts

etemple1
  • 1,748
  • 1
  • 11
  • 13