Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining IP address
Message
De
05/01/2005 18:01:35
 
 
À
05/01/2005 17:30:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
00974538
Message ID:
00974550
Vues:
13
>Hi,
>
>Does anyone know how to determine the dynamic IP address provided by the Internet provider on a given installation using VFP code. I want to build a service that checks if the IP changed. Once a change is detected I would then e-mail the new address to concerned parties.
>
>Regards,
>Neil

The folowing is some code I use. You have to have an internet connection and can navigate to to www.whatismyip.com
?GetPublicIPAddress()

Function GetPublicIPAddress
loExplorer = CreateObject("InternetExplorer.Application")
loExplorer.Navigate2("www.whatismyip.com")
DO WHILE loExplorer.readystate <> 4
ENDDO
loDoc = loExplorer.Document
MyPublicIp = loDoc.Body.Innertext
m.lcReturnYourIP = "UNKNOWN"
if ratc("Your IP is ",MyPublicIp,1) > 0
	m.lcReturnYourIP = strtran(strtran(alltrim(substr(myPublicIp,;
	ratc("Your IP is ",MyPublicIp,1)+11,15)),chr(13)),chr(10))
endif
return m.lcReturnYourIP
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform