-- httptest.lua function main() local ut, uf, ct, cf, gob ut = "default url" ct = "" ptitle("httptest") plabel("URL:") uf = pfield(1,22,50,ut) gob = pbutton("Go") pnl() pnl() cf = pfield(10,30,16383,ct) while 1 do local e, id = pevent() if e == ctlSelect and id == gob then local hc, host, path, pos ut = pgettext(uf) pos = strfind(ut, "/", 1, 1) if pos then host = strsub(ut, 1, pos-1) path = strsub(ut, pos) else host = ut path = "/" end hc = openfile("tcp:"..host..":80","rw") write(hc, "GET "..path.." HTTP/1.0\r\n\r\n") ct = read(hc, "*a") closefile(hc) psettext(cf,ct) end end end main()