ISP Ip Address - How get In Clarion


I want to find the ip address of my Internet Provider. How can I do this in Clarion?


1 Like

Would something like this work?

This SO question has a bunch of other possabilities:

1 Like

Have a look at

This is one way that worked for me.

2 Likes contains clarionfoundry’s FAQ.
This link might take you right there -
if it doesn’t just navigate the tree to Clarionfoundry/communications/ftp/Winsock Woes - Getting IP Address

James, all

I took a look at the COL example (TCP/IP name and address resolution) and it is returning the local IP.

So is there any way to get the public IP (that comes from ISP)?

Maybe try scraping the home page? They have an API, but a cursory look seems as if not what you want.

Regardless of Clarion, there is now way your local machine inside NAT would know the public IPv4 address of your internet gateway (unless it’s set up on a public IP which in rather unlikely). You can only obtain your local machine private IP with Windows API.

Note that your public IP inside NAT may be different depending on the route you take to different networks. It may also change as some routers have a feature of load balancing between 2 internet connections from different providers. Therefore each time you connect to the web your public ip may be different.

However in most cases you would have just one provider or BGP which would have the same IP regardless of the route. Still, you would need something external to tell you which IP you use to connect to it.

Have a look here - the code behind it is simple

$myname= gethostbyaddr($_SERVER['REMOTE_ADDR']);
$country = geoip_country_name_by_name($myname);
$revip = gethostbyname($myname) ;
echo "Your IP: ".$IP."  reverse DNS name is: ".$mynname." country ".$country." " ;
if ( $IP == $revip ):
        echo "your rev DNS name matches" ;
        echo "rev DNS name mismatch" ;
echo "\n" ;

To get just an IP just put this on any php enabled web server
EDIT! It must be outside your local network, but you can rent one for a few dollars a year, there are millions of providers of such a service. You can have this on your website in a subfolder or subdomain.

echo $IP;

and then capture http response using NetTalk NetTalk Documentation Index or or LibCurl for Clarion GitHub - mikeduglas/libcurl: libcurl for Clarion or native Clarion HttpWebRequest (never used that one, but there seems to be an example in Examples\ClaTalk\HttpRequest according to the help file).

1 Like