MATLAB Answers

How to force basic authentication with URLREAD in MATLAB for pages where login is not required?

1 ビュー (過去 30 日間)
goc3
goc3 2016 年 7 月 1 日
As of Release 2013a, the URLREAD function now supports basic authentication. However, I can't get it to work for websites where a login is not required (i.e., for pages where the url will work and will display different text for users that are logged in). For example, if you read in a web page's text from this website, the resulting text will display "Log In" next to "How To Buy" in the top-right corner, rather than your username.
As an example, you can try running the following:
url = 'https://www.mathworks.com/matlabcentral/answers/100103-can-i-perform-basic-authentication-with-urlread-in-matlab';
s = urlread(url)
Whether or not you are logged in using any, or every, browser on your computer, Matlab will simply pull the page as if it were a different browser and you were not logged in, whether or not authentication details are provided to the function. Is it possible to force authentication to be performed for such pages, especially in cases where the login is performed using a pop-up box within the same browser page?

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by