Matlab webread 函数 Matlab爬虫
(2017-04-05 10:40:03)
标签:
matlab爬虫webread |
分类: Matlab |
webread
Read content from RESTful web service
Syntax
data =
webread(url)
data =
webread(url,QueryName1,QueryValue1,...,QueryNameN,QueryValueN)
data = webread(___,options)
[data,colormap,alpha] =
webread(___)
[data,Fs] = webread(___)Description
data url)url
content
in data.
The web service provides
a
data url,QueryName1,QueryValue1,...,QueryNameN,QueryValueN)
query parameters
to url,
as specified by one or more pairs of name-value
arguments.
The web service defines the query parameters.
data options)
weboptions options.
You can use this syntax with any of the input arguments of the previous syntaxes.
To return data as a specific output
type, specify the ContentType options.
To read content with a function,
specify the ContentReader options
a handle to the
function. webread
reads the data with the specified function:
-
If you specify a handle to a function that returns multiple output arguments,
-
webreadreturns all output arguments. -
If you specify a handle to a function that returns no output argument
-
(such as Image Processing Toolbox™ function @implayfor video files), -
webreadreturns no output argument.
webread
specify
the RequestMethod options 'post'.
Many web services provide both GET and POST methods to request data.
[ data,colormap,alpha]
= webread(___)
the web service specified
by url data.
You can use the previous syntaxes to
return the image only.
Use this syntax to return the colormap and alpha channels associated with the image.
webread Content-Type
that specifies an image media type
and if the image format is supported
by imread.
For supported image formats,
see
[ data,Fs]
= webread(___)url
and returns the audio data
in data.
You can use the previous syntaxes to return the audio data
only.
Use this syntax to return the sample rate of the audio data in hertz.
webread Content-Type
that specifies an audio media type
and if the audio format is supported
by audioread.
For supported audio formats, see
【以上信息来自于互联网】 以下为翻译为中文说明
从RESTful Web service的页面中读取内容
PS:REST(是“Representational State Transfer”的缩写)是一种轻量级的Web Services架构风格,其实现和操作明显比SOAP和XML-RPC更为简洁,可以完全通过HTTP协议实现,还可以利用缓存Cache来提高响应速 度,性能、效率和易用性上都优于SOAP协议。
语法
data = webread(url)
data = webread(url,QueryName1,QueryValue1,...,QueryNameN,QueryValueN)
data = webread(___,options)
[data,colormap,alpha] = webread(___)
[data,Fs] = webread(___)
说明
data = webread(url)从URL指定的Web服务中读取内容,并返回数据中的内容。
Web服务提供了一个RESTful API,它返回格式为互联网媒体类型(如JSON,XML,图像或文本)的数据。
‚data = webread(url,QueryName1,QueryValue1,...,QueryNameN,QueryValueN)将查询参数附加到url,由一对或多对名称值参数指定。 Web服务定义查询参数。
ƒdata
= webread(___,options)添加了由web
要以特定的输出类型返回数据,请指定选项的ContentType属性。
要使用函数读取内容,请将该选项的ContentReader属性指定为函数的句柄。 webread从web服务器下载数据并用指定的函数读取数据:
如果指定一个返回多个输出参数的函数的句柄,则webread返回所有输出参数。
如果指定的函数的句柄不返回任何输出参数(如视频文件的Image Processing Toolbox™函数@implay),则webread不返回输出参数。
webread支持HTTP GET和POST方法。要发送HTTP POST请求,请将选项的RequestMethod属性指定为“post”。许多Web服务提供GET和POST方法来请求数据。
④[data,colormap,alpha] = webread(___)从URL指定的Web服务读取图像,并返回数据中的图像。您可以使用以前的语法来仅返回图像。使用此语法返回与图像关联的色彩映射和Alpha通道。
当HTTP响应具有指定图像媒体类型的Content-Type头字段,并且imread支持图像格式时,webread返回图像。有关支持的图像格式,请参阅支持的导入和导出格式。
⑤[data,Fs] = webread(___)从URL指定的Web服务读取音频数据,并返回数据中的音频数据。您可以使用以前的语法仅返回音频数据。使用此语法返回以Hz为单位的音频数据采样率。
当HTTP响应具有指定音频媒体类型的Content-Type头字段并且audioread支持音频格式时,webread返回音频数据。有关支持的音频格式,请参阅支持的导入和导出格式。
喜欢
0
赠金笔

加载中…