24.01.2019, 11:48
Hi every body,
when you install a Logic Machine out from your office or ( your home for logic machine lover's ) and you haven't got any dns suscribe in order to get the IP public, it's important to know the logic machine's site IP public if you want to manage it trough the internet ( whith a nat of course one the HTTP socket )
this is my script for get ip public adress (then you can send it trough email )
---------------------------------------------------------------------------------------
local http = require("socket.http")
value = http.request('http://www.mon-ip.com/en/my-ip/')
if ( value ~= nil and string.match(value,'var Ip') ) then
a = string.find(value,'var Ip')
b = string.find(value,';',a)
c = string.find(value,'\"',a)
d = string.sub(value,c+1,b-2)
log(' IP = ',d)
if ( storage.get('IP PUBLIC') ~= d) then
IP_CHANGED = true
end
storage.set('IP PUBLIC',d)
else
--ERROR NO INTERNET OR www.mon-ip.com stop working
end
---------------------------------------------------------------------------------------
Best regard
when you install a Logic Machine out from your office or ( your home for logic machine lover's ) and you haven't got any dns suscribe in order to get the IP public, it's important to know the logic machine's site IP public if you want to manage it trough the internet ( whith a nat of course one the HTTP socket )
this is my script for get ip public adress (then you can send it trough email )
---------------------------------------------------------------------------------------
local http = require("socket.http")
value = http.request('http://www.mon-ip.com/en/my-ip/')
if ( value ~= nil and string.match(value,'var Ip') ) then
a = string.find(value,'var Ip')
b = string.find(value,';',a)
c = string.find(value,'\"',a)
d = string.sub(value,c+1,b-2)
log(' IP = ',d)
if ( storage.get('IP PUBLIC') ~= d) then
IP_CHANGED = true
end
storage.set('IP PUBLIC',d)
else
--ERROR NO INTERNET OR www.mon-ip.com stop working
end
---------------------------------------------------------------------------------------
Best regard