0

I am currently attempting to use the urlwrite function in MATLAB to download a PDF from the internet. I have been using this method successfully for a while now, but I ran into a new problem last night. The site from which I download the pdfs changed from http to https, and now I get an error in MATLAB when I run my usual code. I am trying to run the following:

urlwrite('https://statsdmz.nba.com/pdfs/20160407/20160407_TORATL.pdf', '/Users/dwm8/Desktop/test.pdf');

but get this error when I do:

Error using urlreadwrite (line 98) Error downloading URL. Your network connection may be down or your proxy settings improperly configured.

Error in urlwrite (line 38) [f,status] = urlreadwrite(mfilename,catchErrors,url,filename,varargin{:});

I did some digging here, and it looks like it may have something to do with Java packages, with which I am not at all familiar. I am running MATLAB 2015a on Mac OSX. Does anyone have a fix for this issue? Thanks for the help!

dwm8
  • 309
  • 3
  • 16
  • Have you tried going to the site in a browser? – sco1 Apr 08 '16 at 15:10
  • interesting, so urlwrite is not supporting https connections? can you try putting http:// and let it re-direct you and see what happens? – GameOfThrows Apr 08 '16 at 15:13
  • @excaza Yes I have no problem accessing the pdf in a browser. (I'm using Chrome). As mentioned, the url is https://statsdmz.nba.com/pdfs/20160407/20160407_TORATL.pdf – dwm8 Apr 08 '16 at 15:22
  • @GameOfThrows I am able to enter http://statsdmz.nba.com/pdfs/20160407/20160407_TORATL.pdf in my browser with http instead of https, which redirects me to the desired https page, but when I run `urlwrite('http://statsdmz.nba.com/pdfs/20160407/20160407_TORATL.pdf', '/Users/dwm8/Desktop/test.pdf');` in MATLAB, I get no error message. However, it saves an empty pdf called `test.pdf` which, when I try to open it, gives the error message `The file “test.pdf” could not be opened because it is empty.` – dwm8 Apr 08 '16 at 15:24

0 Answers0