Tag: imdb

尝试打开URL时,为什么会出现403错误

我目前正在使用http://imdbapi.org上的imdb api来获取有关电影的一些信息。 当我使用API​​并尝试在java中打开此URL时 ,它给出了403错误。 url应该以JSON格式返回数据。 这是我到目前为止的代码(Java 7): import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; public class Test { public static void main(String[] args) { URL url =null; try { url = new URL(“http://imdbapi.org/?q=batman”); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } InputStream is =null; try { […]