One of the easiest way can get web page as string is to use TIdHTTP.Get function.
uses IdHTTP; procedure TForm1.Button1Click(Sender: TObject); var S: string; IdHTTP: TIdHTTP; begin IdHTTP := TIdHTTP.Create(nil); try S := IdHTTP.Get('http://www.tablemaster.webs.com/versioninfo.txt'); ShowMessage(S); finally IdHTTP.Free; end; end;
Below is another approach in TIdHTTP
function ReadFromWeb(url:string):string; const cUSER_AGENT = 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3'; var IdHTTP: TIdHTTP; Stream: TStringStream; begin Result := ''; IdHTTP := TIdHTTP.Create(nil); Stream := TStringStream.Create; try IdHTTP.Request.UserAgent := cUSER_AGENT; try IdHTTP.Get(url, Stream); Result := Stream.DataString; except Result := ''; end; finally Stream.Free; IdHTTP.Free; end; end;