I have certain PDF files at URLs. I can view the files in the browser.
Example URL: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC109492/pdf/pgen.1000626.pdf?tool=pmcentrez
But when I do
URL url = new URL("http://www.ncbi.nlm.nih.gov/pmc/articles/PMC" + pmcid + "/pdf/pgen.1000626.pdf?tool=pmcentrez");
URLConnection con = url.openConnection();
InputStream urlIn = con.getInputStream();
I get java.io.IOException: Server returned HTTP response code: 403
What am I doing wrong?
Thanks in advance
I can be a number of things. To name a few:
User-AgentheaderAcceptheader