How to make a RESTful request through a Kerberos proxy?

4 次查看(过去 30 天)
I am trying to make a RESTful request using the code below:
data = webread('https://www.mySite.com/api/FILE.csv')
However, MATLAB is failing and returns:
Error using webread (line 122)
Could not access server. Host not found: http://proxy:Port
My system has a proxy server implemented and all the connections go through it. I do not have a username or password, I only have a .PEM file with the certificates. How can I solve it?

采纳的回答

MathWorks Support Team
Direct Kerberos support was introduced in MATLAB R2019b. Hence, if you have access MATALB R2019b or newer, you can pass your certificates file as show below:
site = 'https://www.mySite.com/api/FILE.csv';
options = weboptions('CertificateFilename','C:\PATH\TO\YOUR\FILE.pem');
out = webread(site, options)
Refer to the Server Authentication documentation page below for more information:
However, this will mostly likely not work in older versions of MATLAB. In those cases, the best alternative is to use system command 'curl' as follows (ask your system administrator for the exact details on how to set up the call to "curl"):
[status, result] = system('curl https://www.mySite.com/api/FILE.csv --proxy https://your-proxy-web --proxy-user ":" --proxy-negotiate --proxy-cacert PATH/TO/YOUR/FILE.PEM ')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by