This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

GET IP PUBLIC ADRESS
#1
Hi every body, 

when you install a Logic Machine out from your office or ( your home for logic machine lover's  Wink )  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
Reply


Messages In This Thread
GET IP PUBLIC ADRESS - by demeur - 24.01.2019, 11:48
RE: GET IP PUBLIC ADRESS - by Daniel - 24.01.2019, 12:35

Forum Jump: