Pull webpage from MATLAB site using MATLAB (but with login)
Show older comments
Hello there
I have recently been working on a code that pulls information from a webpage and stores it in a file
webread() isn't very hard to use
however, I have gotten to the point where I want to pull pages that can only be seen when logged in
I am using a MATLAB webpage (only visible when logged in) to work on my solution, but I can't quite figure it out
for example,
pageLink = 'https://www.mathworks.com/matlabcentral/cody/groups/345/problems/15-find-the-longest-sequence-of-1-s-in-a-binary-sequence/solutions/new';
options = weboptions;
options.Username = 'myEmail@email.com';
options.Password = 'myPassw0rd';
pageRead = webread(pageLink, options);
(obviously with real information)
This does not work, it always returns the 'You must log in page'
I have also tried to webwrite my options, as well as renaming them the parameters called, such as...
userPage = 'https://www.mathworks.com/login?uri=https%3A%2F%2Fwww.mathworks.com%2Fproducts%2Fmatlab.html';
userId = 'myEmail@email.com';
password = 'myPassw0rd';
webwrite(userPage, 'userId', userId, 'password', password)
and all various options between webwrite and webread and options and named parameters
but it won't return the page as if I was logged in
Could someone direct me along the right path? Is it just MATLAB and should I have tried with a different website or can this be done?
Thanks,
H
1 Comment
HighPhi
on 22 Jul 2020
Accepted Answer
More Answers (1)
Pascal Geschwill
on 30 Apr 2021
Hi,
while this approach seems to work for now, it looks like this is deprecated functionality. At least with 2020a I am getting a warning:
Warning: [STAT,H] = WEB(___) does not return a handle for pages that open in the system browser. Use STAT = WEB(___) instead.
> In web>displayWarningMessage (line 432)
In web (line 96)
In my case, the solution described in this thread worked just as well. I am pulling build histories from our CI server via its REST API and then parsing them in MATLAB.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

