【发布时间】:2012-05-05 14:18:22
【问题描述】:
到目前为止,我有以下一块:
local socket = require "socket.http"
client,r,c,h = socket.request{url = "http://example.com/", proxy="<my proxy and port here>"}
for i,v in pairs( c ) do
print( i, v )
end
这给了我如下输出:
connection close
content-type text/html; charset=UTF-8
location http://www.iana.org/domains/example/
vary Accept-Encoding
date Tue, 24 Apr 2012 21:43:19 GMT
last-modified Wed, 09 Feb 2011 17:13:15 GMT
transfer-encoding chunked
server Apache/2.2.3 (CentOS)
这意味着刚刚完美建立了连接。现在,我想使用这个socket.http 获取我的url's 的标题。我搜索了以前的 SO 问题和luasocket's http documentation。但是,我仍然不知道如何在变量中获取/存储整个/部分页面并对其进行处理。
请帮忙。
【问题讨论】:
标签: sockets lua fetch luasocket