1

I am trying to download a https page using url read:

str=urlread('https://funds.barclaysstockbrokers.co.uk/clients/bsl/search_factsheet_summary.aspx?code=B0XWN14')

Unfortunately, I get an error :

Error downloading URL. Your network connection may be down or your proxy settings improperly configured.

I tried using urlread2 (http://www.mathworks.co.uk/matlabcentral/fileexchange/35693-urlread2/content/urlread2.m)

but that gives me this error:

Response stream is undefined
 below is a Java Error dump (truncated):
??? Error using ==> urlread2 at 217
Java exception occurred:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

What do I need to do?

Ginger
  • 8,320
  • 12
  • 56
  • 99
  • [Possible duplicate](http://stackoverflow.com/questions/1638275/handling-an-invalid-security-certificate-using-matlabs-urlread-command) – Colin T Bowers Nov 22 '12 at 22:17

3 Answers3

1

Here's what I did:

http://www.mathworks.com/matlabcentral/answers/39563-managing-public-key-certificates-in-matlab

Brief Summary: It involved using Chrome to export the certificate then using http://portecle.sourceforge.net/ to add the certificate to Matlab's Java's cacerts file

Jimbo
  • 2,886
  • 2
  • 29
  • 45
0

It is a certificate security trust issue.

I tried the same command in Mathematica, and got this nice looking pop-up window asking me if I want to accept the certificate

str="https://funds.barclaysstockbrokers.co.uk/clients/bsl/search_factsheet_summary.aspx"
Import[str]

enter image description here

When I clicked on accept for this session only, then I got the data OK

I do not use urlread(). But at least now you know why. I do not see options in urlread to do the above. May be you need another API in Matlab to do what you want. May be something at matlab file exchange might handle this.

Nasser
  • 12,849
  • 6
  • 52
  • 104
  • You can drop down and directly call the Java APIs that Matlab's `urlread` is built on top of. Matlab ships with the Apache HttpClient library and you can tweak it to ignore certificate validation errors. Had to do similar at work last year. – Andrew Janke Nov 23 '12 at 02:24
0

After matlab 2014b you can use:

DATA = webread(URL)

This new API does not have all the issues urlread command has.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38