Are you using the buienradar code i shared here recently by the way? That shouldn't be much of a problem regarding the time limitation though.
But anyway, just to explain a bit more, here's an example:
Code: Select all
--------------------------------------------------------------------------------------------------------------
-- API Wunderground call --
--------------------------------------------------------------------------------------------------------------
-- the below curl cmd stores json data to the file as defined in variable 'wuDataFile'
if (wuAPIstation) then
-- where are we requesting data
url = "http://api.wunderground.com/pws:'..wuAPIstation..'/'..country..'/'..city..'.json"
-- create the full curl cmd string with output file and the above target url
cmd = 'curl -Lo '..wuDataFile..' '..url
-- perform the call
local handle = os.execute(cmd)
-- request result
if handle then
-- curl result
print("| CURL request was succesfull)
print("| wuDataFile updated ....... : "..wuDataFile)
end
end
Code: Select all
--------------------------------------------------------------------------------------------------------------
-- wuDataFile processing --
--------------------------------------------------------------------------------------------------------------
-- now in any script you can open the local file and get the data
-- open file and process data
local file = io.open(wuDataFile, "r")
local data= file:read('*all')
file:close()
local jsonLocation = json:decode(data)
-- get the values from the json data (the exact syntax ofcourse depends on the content of the json data)
local latitude = jsonLocation.latitude
local longitude = jsonLocation.longitude
local altitude = jsonLocation.elevation
-- now you can do lots of things with the defined variables... obviously there's more than just three variables in my data, as this is just an example.