![]() |
|
HL Public IP script - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: HL Public IP script (/showthread.php?tid=1148) |
HL Public IP script - Mrinj - 22.12.2017 Hi, Until now I've used this script for the public IP change on HL: Code: ip_old = grp.getvalue('10/1/253')
require("socket.http")
myip = (socket.http.request("http://whatismyip.org/"))
ip = myip:match("[%font%-weight%: 600;\"%>](%d+%.%d+%.%d+%.%d+)")
if ip ~= ip_old then
subject = 'HL has New Public IP'
message = ip
Email('my@email.com', subject, message)
end
grp.checkwrite('10/1/253', ip,dt.string)Unfortunately whatismyip.org is closed and the script is not working. Then I created this one: Code: ip_old = grp.getvalue('10/1/253')
require("socket.http")
ip = (socket.http.request("https://api.ipify.org"))
if ip ~= ip_old then
subject = 'HL has New Public IP'
message = ip
Email('my@email.com', subject, message)
end
grp.checkwrite('10/1/253', ip, dt.string)The csript is working in SciTE (or similar) in this version: Code: require("socket.http")
ip = (socket.http.request("https://api.ipify.org"))
print (ip)What do I do wrong?!? RE: HL Public IP script - FatMax - 22.12.2017 Try this: Code: require('socket.http')
socket.http.TIMEOUT = 5
local data = socket.http.request('http://api.ipify.org')
if not data then
return
log('No response getting IP')
end
ip_old = storage.get('ip_old')
if ip_old == nil then
storage.set('ip_old', data)
end
if data ~= ip_old then
storage.set('ip_old', data)
log('IP changed, new IP is: ' .. data)
endRE: HL Public IP script - Mrinj - 22.12.2017 Working perfect. Thank you FatMax!!! RE: HL Public IP script - Erwin van der Zwart - 22.12.2017 You can remove the require(‘json’) because the script does not use it.. BR, Erwin RE: HL Public IP script - FatMax - 22.12.2017 Removed. It was there for other purposes of the script.. RE: HL Public IP script - davidchispas - 01.03.2021 Code: require('socket.http')
socket.http.TIMEOUT = 5
local data = socket.http.request('http://api.ipify.org')
if not data then
return
log('No response getting IP')
end
ipPublic_old = storage.get('ipPublic_old')
if ipPublic_old == nil then
storage.set('ipPublic_old', data)
end
if data ~= ipPublic_old then
storage.set('ipPublic_old', data)
log('IP changed, new IP is: ' .. data)
end
if data ~= ipPublic_old then
subject = 'IP Pública'
message = 'La nueva ip pública es: ' .. data
mail('xxxxxxxxxxxx', subject, message)
storage.set('ipPublic_old', data)
endHi, I'm using this script and lately it was working fine but now I get notifications every little time (1-2 hours) and the IP has not changed. I receive an email notifying that the IP has changed but it appears blank, and after 60 seconds a second notification arrives with the same IP that I had previously. RE: HL Public IP script - Daniel - 01.03.2021 Maybe run it less often, they might implement some limits. RE: HL Public IP script - Josema - 11.04.2024 (01.03.2021, 15:40)davidchispas Wrote: Did you solve the problem? |