Does anyone know a website that simply returns remote internet IP without returning loads of blurb?
Simple enough to do a HTTP request but don't want loads of blurb to filter through. Any good sites for this purpose?
Cheers
Dans
Explore... Chat... Share...
String GetRemoteIP(bool varJson)
{
const uint16_t port = 80;
const char * host = "api.ipify.org"; // ip or dns
String line = "";
Serial.print("connecting to ");
Serial.println(host);
WiFiClient rclient;
if (!rclient.connect(host, port)) {
Serial.println("connection failed");
}
else
{
Serial.println("Connected to host");
}
String vHTML = "";
vHTML = "GET ";
if (!varJson){
vHTML += "/?";
}else{
vHTML += "/?format=json";
}
vHTML += " HTTP/1.1\r\nHost:";
vHTML += "api.ipify.org";
vHTML += "\r\n\r\n";
rclient.print(vHTML);
for (int i=0; i <= 10; i++){
delay(10); // loop gives 100ms buffer fill time
yield();
}
while(rclient.available())
{
line = rclient.readStringUntil('\r');
}
Serial.println("closing connection");
rclient.stop();
return line;
}
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]