You don’t need to use the TidHTTP
, you can use a simpler component, the TWebBrowser
.
Create a Private Variable (Browser : TWebBrowser;
) and in the Create of your form you load the page with the text file, follow example of loading and creation of Webbrowser at runtime!
Browser := TWebBrowser.Create(Self);
Browser.Navigate('http://websitetips.com/articles/copy/lorem/ipsum.txt');
Note that I created a Webbrowser (Browser) of the type Self
, so he doesn’t need to be visible!
Now just charge the TMemo
with the information:
Memo1.Lines.Add(Browser.OleObject.Document.Body.InnerText);
Important: You should not call the procedure Oleobject.Document.Body in the same event where this Navigate procedure, this generates access violation, ie, you would be trying to get information that has not yet been created! Because, there is a delay, even if small between browsing and downloading the page, take advantage and expand your search on the Webbrowser, had found an event called Documentcomplete that had greatly helped in his future projects with this component!
Thank you, give me a shot on my question!
– Pascal Starting