Autor Beitrag
JoachimQ
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 59


D2, D6 und D7
BeitragVerfasst: Sa 01.11.03 09:45 
Ich möchte die TWebbrowser Komponente verwenden um eine Internetseite zu laden und abzuspeichern. Wie kann ich die Webseite (nur Text) abspeichern?


Moderiert von user profile iconTino: Topic aus Dateizugriff verschoben am Fr 14.01.2005 um 09:35
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 01.11.03 10:42 
so: www.swissdelphicente.../showcode.php?id=597

kleiner tipp: geh mal auf www.swissdelphicenter.ch/de/ und such unter programmier tips nach browser oder IE oder so. da wirste viel fiinden. ich hab dir jetzt nur eine möglichkeit rausgesucht, da gibt es aber noch bessere !

ALSO: Such mal selber :D

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 03.11.03 11:22 
Willst du die HTML Seite auch anzeigen? Wenn ja ist der "Umweg" über die tWebbrowser Komponente ok. Wenn du die Datei, wie beschrieben, aber nur laden und abspeichern möchtest empfehle ich dir nicht die tWebbrowser Komponente zu benutzen. Warum auch? Hier mal ein Code aus unserem Forum um direkt eine HTML Seite als String zu empfangen. Diesen müsstest du nur noch abspeichern:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
function LoadURL(URL: String): String; 
var 
  IOpen, IURL: HINTERNET; 
  Read: Cardinal; 
  Msg: array[0..4096] of Char; 
begin 
  Result := ''; 
  try 
    IOpen := InternetOpen('GetIP', INTERNET_OPEN_TYPE_PRECONFIG, '', '', 
        INTERNET_FLAG_NEED_FILE); 
    if IOpen <> nil then 
    try 
      IURL := InternetOpenUrl(IOpen, PAnsiChar(URL), nil, 0, 
          INTERNET_FLAG_NO_UI or INTERNET_FLAG_PRAGMA_NOCACHE or INTERNET_FLAG_RELOAD, 0); 
      if IURL <> nil then 
      try 
        repeat 
          FillChar(Msg, SizeOf(Msg), 0); 
          if InternetReadFile(IURL, @Msg[0], Pred(SizeOf(Msg)), Read) then 
            Result := Result + Msg 
          else 
            Break; 
        until Read = 0;  
      finally 
        InternetCloseHandle(IURL); 
      end;  
    finally 
      InternetCloseHandle(IOpen); 
    end; 
  except 
  end; 
end;


Gruß
Tino
ixtreme
Gast
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.11.03 11:59 
das geht doch noch leichter mit indy!
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 04.11.03 14:13 
jep denn mit indy wäre das ganze genau eine Zeile code !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
PhilGo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 315

Win 98, Win Longhorn ;-)

BeitragVerfasst: Di 04.11.03 19:34 
Ich bin in Indy voll eine Null :oops: . Aber wie würde man das in Indy genau machen?

Mfg PhilGo

_________________
Sie werden dich finden und töten... Söhne der großen Bärin!
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 04.11.03 20:56 
die http kompo aufs formular werfen und dann mit htmlcode := idhttp1.get ('http://www.delphi-forum.de');

_________________
In the beginning was the word.
And the word was content-type: text/plain.