在客户端上显示页面(通过使用socket.request从lua获取数据)

我正在尝试使用Lua访问跨域服务器。

我从服务器(HTML代码)收到了响应。

现在,我需要在我的网站上显示这个页面。

代码:

    --body, header, status, error

b, h, s, e = socket.http.request{url = "http://someurl"
    , proxy = "http://someProxy"
    , sink = ltn12.sink.file(io.stdout)

    }

sink属性完成了它的工作,将HTML打印回了客户端。

我正在使用ExtJS开发客户端代码。

我的问题是,如何显示接收到的页面?

谢谢, Yoni

原文链接 https://stackoverflow.com/questions/4803831

点赞
stackoverflow用户4323
stackoverflow用户4323

我认为您会想在Lua中将输出捕获到字符串中,而不是让sink成为io.stdout,然后使用其中一种方法将该字符串与“3种在ExtJS容器中呈现HTML的方式”之一一起使用。

至于将数据写入字符串而不是stdout,可能会像这样:

local t = {}
sink = ltn12.sink.table(t)
-- ...
local html = table.concat(t)
2011-02-19 20:28:32