Jump to content

Copy TEXT from UniURLFrame into uniMemo...


erich.wanker

Recommended Posts

Hy ...

 

i have a UniURLFrame ...  -> URL ="http://seilbahn.net/sn/rss.php"...

 

OnFrameLoaded i try to copy the loaded html text into a Memofile .. but i find no working solution:

 

procedure TMAINFRAME_FNEWS.UniURLFrame1FrameLoaded(Sender: TObject);
var ts:TMemoryStream;
begin

// 1. Try
ts:= TMemoryStream.Create;
try
uniURLFrame1.HTML.SaveToStream(ts);
uniMemo1.Lines.LoadFromStream(ts);
finally
    ts.Free;
end;

//2. Try
UniMemo1.Text:=uniURLFrame1.HTML.Text;

//3. Try
UniMemo1.Lines:= uniURLFrame1.HTML;

end;

.. the uniMemo is allways empty .. the uniURLFrame shows text ..

 

 

HOW can i load the output of "http://seilbahn.net/sn/rss.php"into uniMemo1 ??

 

ThanX for help

Erich

Link to comment
Share on other sites

perfect .. !  THANX 

 

 

 

 

uses unit: IdHTTP

 

const
  HTTP_RESPONSE_OK = 200;

 

function GetPage(aURL: string): string;
var
  Response: TStringStream;
  HTTP: TIdHTTP;
begin
  Result := '';
  Response := TStringStream.Create('');
  try
    HTTP := TIdHTTP.Create(nil);
    try
      HTTP.Get(aURL, Response);
      if HTTP.ResponseCode = HTTP_RESPONSE_OK then begin
        Result := Response.DataString;
      end else begin
        // TODO -cLogging: add some logging
      end;
    finally
      HTTP.Free;
    end;
  finally
    Response.Free;
  end;
end;

unimemo1.Text:=GetPage('http://seilbahn.net/sn/rss.php');

 

Works :-)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...