Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Call web page, capture output as string?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Divers
Thread ID:
00999280
Message ID:
00999286
Vues:
34
Thanks fo the input. I found the solution on Rick Strahls web page in the wwhttp docs section.

It ends up being very simple one you have wwIPStuff:
SET PROCEDURE TO wwUtils ADDITIVE
SET CLASSLIB TO wwIPStuff Additive

o=create("wwIPSTUFF")
lcHTML = o.HTTPGet('http://myweb.com')
>Hi Cetin,
>
>Thanks for the great parsing info. I guess the area I am having difficulty in is actually making the call to the web site without loading a browser object.
>
>This app is in VFP 7 and I am not seeing much in the way of HTTP functionality, maybe a later version does have that. I am also looking at Rick Strahls wwHTTP function, but I don't have that version of wwIPStuff yet, so I haven't tested.
>
>Thanks again Cetin.
>
>David
>
>
>>>A customer has a web-based application that returns a simple text html string. I can call the web app from my browser, and the results are displayed.
>>>
>>>How can I programatically call the web page and (instead of displaying the output in a browser) capture the output as a string?
>>>
>>>Thanks very much in advance.
>>>
>>>David
>>
>>Something like this?
>>
>>Local m.myHTML,m.parsed
>>myHTML=[This<br> is an <font color="red"><b>example</b></font><Hr>x2 < x3]
>>*myHTML= FileToStr(GetFile('HTM'))
>>parsed = ''
>>oParser = Createobject('myParser',m.myHTML,@m.parsed)
>>? m.Parsed
>>*StrToFile(m.Parsed,'ParseResult.txt')
>>
>>Define Class myParser As Form
>>  Add Object oWB As OleControl With ;
>>    OleClass = 'Shell.Explorer'
>>
>>  Procedure Init
>>  Lparameters tcHTML, tcParse
>>  lcTemp = Sys(2015)+'.htm'
>>  Strtofile(tcHTML,lcTemp)
>>  With This.oWB
>>    .Navigate2('file://'+Fullpath(lcTemp))
>>    Wait window 'Parsing...' nowait
>>    Do While .ReadyState # 4 && Wait for ready state
>>    EndDo
>>  Endwith
>>  Erase (lcTemp)
>>  tcParse = This.oWB.Document.body.innerText
>>  Wait clear
>>  Return .f.
>>Endproc
>>Enddefine
>>
Cetin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform