Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我无法使用以下java代码获取facebook资源页面:_Java_Php_Html_Facebook - Fatal编程技术网

我无法使用以下java代码获取facebook资源页面:

我无法使用以下java代码获取facebook资源页面:,java,php,html,facebook,Java,Php,Html,Facebook,对于测试,我想尝试使用以下java代码获取facebook资源页面: 它适用于除facebook\twitter以外的任何其他网站,有解决方案吗 public class ReadWebPage { public static void main(String[] args) { String urltext = "http://www.facebook.com"; BufferedReader in = null; try { URL url = new URL(urltext);

对于测试,我想尝试使用以下java代码获取facebook资源页面: 它适用于除facebook\twitter以外的任何其他网站,有解决方案吗

public class ReadWebPage {
  public static void main(String[] args) {

String urltext = "http://www.facebook.com";
BufferedReader in = null;
try {
  URL url = new URL(urltext);
  in = new BufferedReader(new InputStreamReader(url.openStream()));

  String inputLine;
  while ((inputLine = in.readLine()) != null) {
    System.out.println(inputLine);
  }
} catch (Exception e) {
  e.printStackTrace();
} finally {
  if (in != null) {
    try {
      in.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
  }
} 

返回了哪些错误?我怀疑这与“重定向到”有关。我建议尝试https地址,看看这是否能解决问题