函数urlread: Download URL content to character vector. Urlread is not recommended. Use webread or webwrite instead. (webread和webwrite是MATLAB的新增功能)
str = urlread(URL)
str = urlread(URL, Name, Value)
URL:网页地址,NAME:get或是post,Value:要向网页传递的参数。
一般中文网页的网页编码是'GBK',调用语法是:
S=urlread('http://sina.com.cn','get','','GBK')
example1:
fullURL = ['http://www.mathworks.com/matlabcentral/fileexchange', '?term=urlread'];
str = urlread(fullURL);
urlread从指定的URL读取并将HTML内容下载到字符向量str。 example2:
Download Web Content Related to Term
URL = 'http://www.mathworks.com/matlabcentral/fileexchange';
str = urlread(URL,'Get',{'term','urlread'});
urlread从http://www.mathworks.com/matlabcentral/fileexchange/?term=urlread中读取,并将HTML内容下载到字符向量str。 example3:
fullURL = ['http://www.mathworks.com/matlabcentral/fileexchange', '?term=urlread'];
str = urlread(fullURL,'Timeout',5);
|