Include IP address as const char* in URL

Hello,

My program will get the surfing condition from the location of my IP address (using esp8266) and display it.

For that I am getting first my IP address (WiFi.localIP()) then I wil get the gps coordinate of this IP address using the API http://api.ipstack.com.

Once I have the gps coordinates I will request different surf report website.

My problem is the following :

I cannot include a the IP address as const char* (myip) into the URL :

http0.begin("http://api.ipstack.com/"+ myip + "?access_key=20ee628191894239fe9857f434ffd3b3&format=1");

I get this mesage :
invalid operands of types 'const char*' and 'const char [54]' to binary 'operator+'

I tried to convert the IP address to String but the request to the API shall be in this format : "xxx.xx.xx.xxx"

Could you please advice me in this matter ?

I attached the relative part of my program.

Thanks,
Théophile

SR_V0_forum.ino (1.9 KB)

change

const char* myip = "blahblah";

to

String myip = "blahblah";

It works, Thanks !

Have a good day,
Théo

I hope you understand that this technique won't be too accurate for locating the position of anyone using a satellite based internet provider.

Don