Page 1 of 1

WGET$ IPIFY not working anymore

Posted: Sun Oct 31, 2021 8:09 pm
by Hendrix
I have a module at a remote site sending me its external IP address once a day.
Lately, I just sends me messages "Connection Failed". Any idea what could be causing this?


' -- INIT --
EMAIL.SETUP "smtp.gmail.com", 465, "USER", "PASSWORD"

' -- MAIN --
do
a$= "External IP-address= " + WGET$("api.ipify.org/", 443)
r = EMAIL ("", "EMAIL_ADDRESS", "SUBJECT", A$)

select case r
case 0
print "Email fail."
case 1
print "Email success.",a$
case else
print "Email unknown."
end select

wait 20000
loop

RESULT:
Email success. External IP-address= Connection Failed

Re: WGET$ IPIFY not working anymore

Posted: Tue Nov 02, 2021 1:40 am
by Fernando Perez
Hendrix, if it worked before and not now, it is because something will have changed on the server that your wget$ points to.
From Windows Power Shell ping "api.ipify.org" and you will see it change to "api.ipify.org.herokudns.com", with no response.

I advise you to change to another server, such as "ip.seeip.org" or even my domain's, "https://www.myrapidq.it/ip.php".

Code: [Local Link Removed for Guests]

url$ = "www.google.com"
gosub qPing

url$ = "ip.seeip.org"
gosub qPing
url$ = "https://ip.seeip.org/jsonip?"
result$ = wget$(url$)
a$ = json$(result$, "ip")
wlog "IP: "; a$

url$ = "www.myrapidq.it"
gosub qPing
url$ = "https://www.myrapidq.it/ip.php"
result$ = wget$(url$)
a$ = word.extract$(result$, "IP: ", "<")
wlog "IP: "; a$

url$ = "api.ipify.org"
gosub qPing
url$ = "https://api.ipify.org"
result$ = wget$(url$)
wlog result$

END

qPing:
  result = ping(url$)
  wlog "------------------------"
  wlog url$
  if result = 1 then wlog "Ping OK" else wlog "Ping fail"
return


Re: WGET$ IPIFY not working anymore

Posted: Fri Nov 05, 2021 12:03 pm
by Hendrix
Thanks for solving my problem.
I now get this output:

------------------------
www.google.com
Ping OK
------------------------
ip.seeip.org
Ping OK
IP: nn.nn.nn.nn
------------------------
www.myrapidq.it
Ping OK
IP: nn.nn.nn.nn
------------------------
api.ipify.org
Ping fail
Connection Failed