How get my public IP address displayed on the webpage

Hello,
How do I view my public IP address from “https://ipv4.icanhazip.com” web site?
I only retrieve the IP of the site and not the displayed content string!
Thanks,

Please explain more what you are trying to do, what you have tried so far, and what the problem is. That API is working correctly, returning the IP address that accessed it.

I just want to retrieve the IP address which is displayed on the web page of the site. (and not retrieve the IP address of the site).
To understand, type the URL address https://ipv4.icanhazip.com
I tried this, but it doesn’t do what I want to do:

Var socket1 As New HTTPSocket
Var pubip As String = socket1.Get("https://ipv4.icanhazip.com", 10)
// or Var pubip As String = URLConnection1.SendSync("GET", "https://ipv4.icanhazip.com", 10)
msgbox(pubip)

Thanks

I have. The API responds with the address that accessed it. It’s working as expected here for a web browser, Paw (an API tool), and even with your Xojo code above.

Perhaps you need to look at your network configuration.

Same as Tim said, working here

I get the expected result for my network but as Tim stated, your network can give results you are not expecting

Are you creating a web app and the code is running on your web server?

So you want to know your visitors IP by using that site by calling it from your webserver and always getting your webserver IP back?

Try

MessageBox session.Header("HTTP_CLIENT_IP")

If it’s a web app (which OP said nothing about) it’s built into the framework:
WebSession.RemoteAddress

If it is a web app then the OP posted in the wrong section

Great. I did not realize that was built in.

I assumed that the OP wanted web, since otherwise it makes little sense to do that in a desktop app.

I would not say it makes little sense
There are legitimate reasons for using the clients IP in a Desktop Application

1 Like

Assuming a desktop app has access to Internet is not a given.

But indeed, perhaps the OP wants to scrap the site he posted ?

True, but if the goal of the desktop app is to say use web API then it is a given
Would it not be up to the creator to check for Internet connection?

To day it is expected that not all desktop applications are cut off from the outside world

There are still many places in the middle of nowhere with no Internet of 5G.

That is true
BUT does there need to be 5G?
Xojo checks how many computers you are building from? Checking license restrictions?
There is a valid reason for desktop applications

I never said there was no valid reasons. Just that there are customers without Internet.

At any rate, since the OP does not seem to want to explain what he is after, this discussion is getting nowhere.

Agreed
Without the OP explaining the true intent then we can only guess

Yes, that’s good thanks, I just forgot to disable Safari’s Private Relay!
To display the IPv6 address, is it possible?

https://ipv6.icanhazip.com/ ?

No. Don’t work.