如何发出 HTTP 请求并获取响应内容和响应标头?
问问题
1486 次
4 回答
7
或者使用新的Zinc 框架,例如:
| response content headers |
response := ZnClient new
url: 'http://stackoverflow.com';
get;
response.
content := response contents.
headers := response headers.
于 2012-02-01T23:47:44.577 回答
3
可能最简单的方法是WebClient
从http://www.squeaksource.com/WebClient加载。
于 2010-08-23T06:05:08.357 回答
1
要安装 WebClient:
(Installer ss project: 'WebClient')
install: 'WebClient-Core'
接着
response := WebClient httpGet: 'http://www.google.com/'.
headers := response headers. "An OrderedCollection of headername -> headervalue"
body := response content.
于 2010-08-26T12:38:23.347 回答