Nigel Whitworth's Development Site

You are currently not logged in.

How do I find out the IP address of a website?

This function will return an array of string variables where each line is an IP address associated with the website.

Imports System.net

Public Function GetWebsiteIPs(ByVal strSite As String) As String

     Dim objHost As IPHostEntry
     Dim objIPs As IPAddress
     Dim strIP As String
     Dim lngPtr As Long

     Try
          objHost = Dns.GetHostEntry(strSite)
          objIPs = objHost.AddressList
          ReDim strIP(objIPs.GetUpperBound(0))
          For lngPtr = 0 To strIP.GetUpperBound(0)
          strIP(lngPtr) = CStr(objIPs(lngPtr).GetAddressBytes(0)) & "." & _
               CStr(objIPs(lngPtr).GetAddressBytes(1)) & "." & _
               CStr(objIPs(lngPtr).GetAddressBytes(2)) & "." & _
               CStr(objIPs(lngPtr).GetAddressBytes(3))
          Next

          Return strIP

     Catch ex As Exception
          Return strIP
     End Try

End Function


If you intend to vote or make a comment, please enter the security code.

Make a comment

*Comments are the views of individuals, they may or may not be correct.
All comments are reviewed and accepted or rejected.
If you give an email address, you will be sent an email when someone makes a comment on this page.*

Name :
Email :
Comments :


Only name and Code is compulsory.
 
 
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)