Is it possible to determine the current IP Address for a URL.
Example: What its the current IP Address for www.google.com ?
I've searched the forums and found a method to find the IP address of the local host. That may be a start.
Any help, code sample, or advice appreciated.
Terry
How to deterine the IP address of a URL
-
TerryHough
- Enthusiast

- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
Re: How to deterine the IP address of a URL
One solution that works for me is from PWS32
Code: Select all
; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=834&highlight=
; 2. Mai 2003
; Author: PWS32
Structure HOSTENT
h_name.l
h_aliases.l
h_addrtype.w
h_length.w
h_addr_list.l
EndStructure
Procedure.s GetIPbyName (NameIP.s)
TheIPAdress.s
If InitNetwork()
pHostinfo = gethostbyname_(NameIP)
If pHostinfo = 0
TheIPAdress = "Unable to resolve domain name"
Else
CopyMemory (pHostinfo, hostinfo.HOSTENT, SizeOf(HOSTENT))
If hostinfo\h_addrtype <> #AF_INET
MessageRequester("Info","A non-IP address was returned",0)
Else
While PeekL(hostinfo\h_addr_list+AdressNumber*4)
ipAddress = PeekL(hostinfo\h_addr_list+AdressNumber*4)
TheIPAdress = StrU(PeekB(ipAddress),0)+"."+StrU(PeekB(ipAddress+1),0)+"."+StrU(PeekB(ipAddress+2),0)+"."+StrU(PeekB(ipAddress+3),0)
AdressNumber+1
Wend
EndIf
EndIf
Else
MessageRequester("Info","Network can't be initialized",0)
EndIf
ProcedureReturn TheIPAdress
EndProcedure
Debug GetIPbyName ("www.google.de")-
TerryHough
- Enthusiast

- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact: