erich.wanker Posted August 23, 2016 Posted August 23, 2016 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 Quote
Sherzod Posted August 23, 2016 Posted August 23, 2016 Hi, You cannot circumvent the cross-domain policy. Best regards. Quote
ZigZig Posted August 23, 2016 Posted August 23, 2016 But maybe you can get the source of the page (which seems to be pure XML), instead of trying to load its content from a frame. Quote
zilav Posted August 23, 2016 Posted August 23, 2016 Yep, just load it with Indy and paste into memo. 1 Quote
erich.wanker Posted August 25, 2016 Author Posted August 25, 2016 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 :-) Quote
zilav Posted August 25, 2016 Posted August 25, 2016 Make sure that Indy timeout is less than AjaxTimeout of unigui just in case. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.