This will work from within vfp as long as you can create an instance of IE
and the website 'www.whatismyip.com' is up and running. This is quick and
dirty - add your error checking:
*create instance of IE
If Type('OIE')='U'
        Public oie
        oie=Creat('internetexplorer.application')
        OIE.VISIBLE=.T.
ENDIF

lcurl=[http://www.whatismyip.com]
oie.Navigate(lcurl)
* I find you have to have three levels of checking on the web stuff
* first check oie's readystate, then the documents, then the busy state of
IE
Do While oie.readystate<>4
Enddo
Do While oie.Document.readystate<>'complete'
Enddo
Do while oie.busy
Enddo
* you might want to check on the existence of the next line (error trapping)
lc=oie.Document.body.innertext
* If it fails, return 'none'
LCIP='NONE'
FOR i = 1 TO MEMLINES(lc)
lcline=UPPER(MLINE(lc,i))
IF OCCURS('YOUR IP IS',LCLINE)>0
 lcip=STRTRAN(lcline,'YOUR IP IS','')
ENDIF
ENDFOR

?LCIP


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of MB Software Solutions
Sent: Monday, January 29, 2007 1:10 PM
To: profox@leafe.com
Subject: Re: Any way to get WAN IP in VFP app?

Dave Crozier wrote:
> Michael,
> If you can shell out to a command line then run the command:
>
> ping -r 1 www.yahoo.com
>
> You will get back in the resulting message the WAN IP address. You can
> obviously pipe the command out to a text file and examine this to extract
> the WAN IP address
>
> Dave Crozier
>   

Not reliable in my tests.  I think the best thing to do is perhaps just 
do a NavigateTo with some tool of Rick Strahl's wwIPStuff.vcx and scrape 
the returned text for the value of "displaycopy" (between the parenthesis).

-- 
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"



[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to