local http = getInternet()
local response = http.getURL("www.google.com")
http.destroy()
for line in response:gmatch("[^\n]+") do
for name, value in line:gmatch('"(.+)": "(.+)"') do
print(name .. " = " .. value)
end
end
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
Posted: Wed Jul 20, 2016 8:02 pm Post subject:
The response is json. You can use a json parser for Lua to read the data from the response easily back into a Lua table. There are several Json implementations around the new for Lua that you can make use of. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum