Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get data from web
Message
De
24/05/2013 03:51:23
 
 
À
24/05/2013 03:24:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Divers
Thread ID:
01574616
Message ID:
01574622
Vues:
70
>Tariq,
>
>Have you received anything on this yet? Let me know if you do. I too am looking into do something like this in the very near future. Different sort of site but the concept of pulling data from the internet.

It's actually very easy, and Tariq already got help from me on his problem, in another forum. The steps are:
1. Read the html from the website into a variable
2. Use alines() to create an array, one element per html line
3. Scan the array for identifiers before and after what you want t extract
4. Use Strextract() to extract the value you want, using the identifiers from 3.

Here's a very simple program to get the html:
function geturldata
lparameters tlURL
lcReturn = ''
if !empty(tlURL)
   loWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
   loWinHttp.Open('GET',tlURL,.F.)
   loWinHttp.send()
   lcReturn = loWinHttp.ResponseText 
Endif
return lcReturn
To get this into an array:
lcUrl = 'http://www.yourwebsite.com/'
lcHtml = geturldata(lcUrl)
lnLines = alines(laHtmlline,lcHtml)
Now you can use ascan() to scan for whatever you want. Or you can create a cursor and "append from array laHtmlline", if you prefer to work with cursors.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform