You do not need to use TidHTTP
, you can use a simpler component, TWebBrowser
.
Create a variable in the Private ( Browser : TWebBrowser;
) and in the Create of your form you load the page with the text file, follow example of loading and creating WebBrowser at run time! / p>
Browser := TWebBrowser.Create(Self);
Browser.Navigate('http://websitetips.com/articles/copy/lorem/ipsum.txt');
Note that I created a WebBrowser (browser) of type Self
, so it does not have to be visible!
Now just load TMemo
with the information:
Memo1.Lines.Add(Browser.OleObject.Document.Body.InnerText);
Important: You should not call the OleObject.Document.Body procedure in the same event where the Navigate procedure is, this generates access violation, ie you would be trying to get information that you do not already have was raised! Well, there is a delay, even if small between browsing and downloading the page, enjoy and expand your WebBrowser search, you will find an event called DocumentComplete that will greatly help your futurus projects with this component!