Autor Beitrag
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: So 25.05.03 11:05 
Wie kann ich eine Textdatei von einem Webserver (z.B.: domain.tld/datei.txt) in ein memo laden?
Mit
ausblenden Delphi-Quelltext
1:
memo1.lines.LoadFromFile('http://domain.tld/datei.txt');					

geht es nicht

_________________
Klein, schwarz und ärgert Techniker? Jumper!
GruppeCN
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 322



BeitragVerfasst: So 25.05.03 11:22 
Geht ganz einfach:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
uses ... URLmon, ShellAPI;

function download(url, pfad:string): Boolean;
begin
  Result := UrlDownloadToFile(nil, PChar(url), PChar(pfad), 0nil) = 0;
end;

procedure TForm1.Create(Sender: TObject);
begin
  if download('http://www.domain.de/datei.txt',ExtractFilePath(Paramstr(0)) + 'datei.txt'then begin
  memo1.lines.loadfromfile(ExtractFilePath(Paramstr(0)) + 'datei.txt');
end
else ShowMessage('Fehler beim Download!');

_________________
Warum sind die Sachen, die du suchst, immer da, wo du zuletzt nachsiehst?
Weil du aufhörst zu suchen, wenn du sie gefunden hast.
blackbirdXXX Threadstarter

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: So 25.05.03 11:34 
Danke : :)

_________________
Klein, schwarz und ärgert Techniker? Jumper!