How to find out the IP of an external URL

Hi there,

I have a list of URL that I need to find out what are the IPs for each one of them. What would be the best way of finding that out?

Hi,
I think you could use “ping” to get the IP address.

In UiPath you need to instance a ping variable and a ping reply variable and then just use method .Send(“YOUR URL HERE”) and store it in the ping reply. Then you can easily get the IP Address using property .Address

Here is the UiPath project in case you want to test it :slight_smile:
IP_Address_Test.zip (2.3 KB)

3 Likes

HI,

If you can use DNS for the host, the following will work.
(This can return multiple IP addresses if the host has)

strUrl = "https://forum.uipath.com"
uri = New Uri(strUrl)
hostName = uri.Host
ipHostEnt = System.Net.Dns.Resolve(hostName)
arrIp = ipHostEnt.AddressList

then iterate arrIp.

currentItem.ToString returns IP address as string

Sample
Sample20231124-4.zip (2.8 KB)

Regards,

1 Like

I used this one, even though it’s quite time consuming. I’m looping through a file with tens of thousands of URLs and it’s taking forever. The first run took more than 24 hours, and the slowest part was the Ping activity,

Do you think this would preform better than the Ping command?

Hi,

From the view point of network architecture, yes. Because Ping command resolves host address using DNS first, then sends ICMP (ping) to the target host. So it’s unnecessary to send ICMP, If you need to know just IP address. Can you try to use just DNS like the my preivous post? Not only It can get multiple IP addresses but also it works even if the target host is down. (Because it doesn’t communicate with the target host)

Please note that it may not work if DNS server is in closed network such as intranet of company.

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.