Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detemining a computer's
Message
From
11/05/2001 11:44:14
Jorge Haro
Independent Consultant
Juarez, Mexico
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Detemining a computer's
Miscellaneous
Thread ID:
00506227
Message ID:
00506227
Views:
51
... as opposed to the automatically assigned private network IP address of a cable modem, I wrote this program that uses a script ( in Pearl I believe, it's not mine ) somewhere in the internet, and it works fine for now, the problem is that it relies on that script being there.
#DEFINE READYSTATE_COMPLETE 4
#DEFINE MAX_TIME 30

local loIE 		&& Internet Explorer object
local lcInnerText 	&& Text of the webpage
local lcIPAdd 		&& IP Address as a string
local lnStartedAt	&& Seconds when started loading
local lnWaiting  	&& Seconds waiting for the document to load
local lcRetVal		&& Return Value

loIE = createobject( 'internetexplorer.application' )

lnStarted = SECONDS()

loIE.navigate( 'http://www.internet-help.net/cgi-bin/ip-address.pl' )


do while loIE.Readystate <> READYSTATE_COMPLETE or lnWaiting >= MAX_TIME

	lnWaiting = Seconds() - lnStarted

enddo

if lnWaiting < MAX_TIME

	lcInnerText = loIE.Document.Body.InnerText

	lcIPAdd = allt(substr(lcInnerText , at( ':' , lcInnerText , 2 ) + 1 ) )

	lcRetVal = lcIPAdd

else

	lcRetVal = 'Timeout'

endif

?lcRetVal
TIA
Next
Reply
Map
View

Click here to load this message in the networking platform