Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 6 - getting data from served page 1

Status
Not open for further replies.

eric43

Programmer
Apr 29, 2005
94
AU
I am using a mapping site from within a VFP form using text address searches and it works very well.

Within the source of the downloaded page on the client PC is the following morsel of information that I would like to capture


Code:
<dd class="latitude">35:07:16S (-35.121)</dd>
 <dt>Lon:</dt>
 <dd class="longitude">138:32:05E (138.5347)</dd>
I would like to capture the latitude and longitude to variables for further use in a database


Is this possible.

Thanks

Eric
 
I am not sure if STREXTRACT exists in VFP6, so I'll give you both examples:
Code:
*** With STREXTRACT
<dd class="latitude">35:07:16S (-35.121)</dd>
LOCAL lcFile
lcFile = FILETOSTR([my downloaded file])
lcLatitude = STREXTRACT(lcFile,[<dd class="latitude">],</dd>,1)
lcLongitude = STREXTRACT(lcFile,[<dd class="longitude">],</dd>,1)
** That would give you
** lcLatitude  = 35:07:16S (-35.121)
** lcLongitude = 138:32:05E (138.5347)

other way

Code:
LOCAL lcFile, lnAt
lcFile = FILETOSTR([my downloaded file])
lnAt   = ATC([<dd class="latitude">],lcFile)
IF lnAt > 0
   lcLatitude = SUBSTRING(lcFile,lnAt+21)
   lnAt   = ATC([</dd>],lcLatitude)
   IF lnAt > 0
      lcLatitude = LEFT(lcFile,lnAt-1)
   ENDIF
ENDIF

lnAt   = ATC([<dd class="longitude">],lcFile)
IF lnAt > 0
   lcLongitude = SUBSTRING(lcFile,lnAt+22)
   lnAt   = ATC([</dd>],lcLongitude)
   IF lnAt > 0
      lcLongitude = LEFT(lcFile,lnAt-1)
   ENDIF
ENDIF

not tested and no error hadling

Borislav Borissov
 
Thanks Boris,

I have that working.

Rather have the user have to save the page is it possible to pick it up without saving?

Regards

Bryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top