I am trying to get an InputStream from a url. URL can be opened from Firefox. It returns json, and I installed the addon to view json in Firefox, so I can view it there.
So, I tried to get it with Java:
URL url = new URL(urlString);
URLConnection urlConnection = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
But it throws an IOException in urlConnection.getInputStream ().
I also tried:
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
InputStream inputStream = url.openStream();
But no luck.
Any information is noticeable. Thanks in advance.
source
share