Skip to content

Instantly share code, notes, and snippets.

@henriquegogo
Created June 1, 2015 20:18
Show Gist options
  • Save henriquegogo/863c2d1a226d20c96d60 to your computer and use it in GitHub Desktop.
Save henriquegogo/863c2d1a226d20c96d60 to your computer and use it in GitHub Desktop.
Http request with lua
#!./bin/lua
local http = require('socket.http')
local cjson = require('cjson')
local response = http.request('http://www.w3schools.com/website/customers_mysql.php')
local customers = cjson.decode(response)
for i,customer in pairs(customers) do
print(customer.Name ..', '.. customer.City ..' - '.. customer.Country)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment