我试图使用urlread来获取一个受密码保护的网站的内容。当我登录时,url是http://media.nba.com/Stats/OfficialBoxScores.aspx,当我注销时,url是http://media.nba.com/Stats/Login.aspx?ReturnUrl=%2fStats%2fOfficialBoxScores.aspx。我试过了
urlread('http://media.nba.com/Stats/OfficialBoxScores.aspx','Username','username','Password','password');
与我的登录凭据,但它只给我的内容,url之前登录。我看到这个问题以前有人问过,但我找不到解决我的情况的办法。有没有办法使用urlread通过密码保护墙?
任何帮助都将不胜感激!
发布于 2014-10-13 22:35:08
您需要指定method (使用'post'),参数需要是名称/值对的单元格数组。
这是否有效:
urlread('http://media.nba.com/Stats OfficialBoxScores.aspx','post',{'Username','username';'Password','password'} );发布于 2018-07-23 18:12:21
%Allows you to access url that requires username and password
url_login = 'https://www.your-website-loginpage'
url_data = 'https://www.your-website-data-url'
[stat,h] = web(url_login) %Enter username and password in the popup
setCurrentLocation(h, url_data)
pageText = h.getHtmlText()https://stackoverflow.com/questions/26349881
复制相似问题