Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Question
mdejager 1
Hi,
I am using an httpclient request to get an address out of json array of google maps. It is working perfect but I would like to have the value out of the request scope/block.
I get a value at 1 but I do not get a value at 2. I hope someone can help me. Thank you!
longitude = 52.568197
latitude = 4.560753
http = net. HTTPClient ()
http : request ( 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' .. longitude ..',' .. latitude .. '&sensor=false',
{
options = { method = "POST" },
success = function (result)
output = json.decode(result.data);
address = (output.results[1].formatted_address);
print("1:" .. address)
end,
error = function (err) fibaro: debug ("Errortje:" .. err); end
})
print ("2: " .. address
Link to comment
Share on other sites
13 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.