Jump to content

Copy TEXT from UniURLFrame into uniMemo...


erich.wanker
 Share

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...