Facebook graph api 访问graph.facebook.com时出现未知主机异常

Facebook graph api 访问graph.facebook.com时出现未知主机异常,facebook-graph-api,json.net,facebook-java-api,Facebook Graph Api,Json.net,Facebook Java Api,访问URL时,我收到一个java.net.unknownhostexception,但我可以通过浏览器访问 public static void main(String[] args) throws IOException, JSONException`enter code here` { JSONObject json = readJsonFromUrl("https://graph.facebook.com/page_id/? access_token=xxxxx&fie

访问URL时,我收到一个java.net.unknownhostexception,但我可以通过浏览器访问

      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"));
}

您使用的请求URL无效。在您的请求URL中,将
page_id
更改为您试图请求数据的实际Facebook页面id,并包括您正在使用的API版本

例如,如果我想访问id为3454546的页面-

https://graph.facebook.com/v2.9/3454546?access_token=xxxxx&fields=name,喜欢,发布