Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Начинающим";
Текущий архив: 2007.03.25;
Скачать: [xml.tar.bz2];

Вниз

Загрузка веб страницы как html код   Найти похожие ветки 

 
arturich ©   (2007-03-03 23:28) [0]

Люди, подскажите, пожалуйста, как загрузить веб страницу, допустим, в TMemo как её html код?


 
DVM ©   (2007-03-03 23:39) [1]

procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Text :=idhttp1.Get("http://delphimaster.net/view/2-1172953711/");
end;


 
Dmitrij_K   (2007-03-04 00:08) [2]

URLDownLoadToFile
UrlMon.pas


 
Fredy314 ©   (2007-03-04 09:25) [3]

uses
 Wininet;

function DownloadURL(const aUrl: string): Boolean;
var
 hSession: HINTERNET;
 hService: HINTERNET;
 lpBuffer: array[0..1024 + 1] of Char;
 dwBytesRead: DWORD;
begin
 Result := False;
 // hSession := InternetOpen( "MyApp", INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
 hSession := InternetOpen("MyApp", INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
 try
   if Assigned(hSession) then
   begin
     hService := InternetOpenUrl(hSession, PChar(aUrl), nil, 0, 0, 0);
     if Assigned(hService) then
       try
         while True do
         begin
           dwBytesRead := 1024;
           InternetReadFile(hService, @lpBuffer, 1024, dwBytesRead);
           if dwBytesRead = 0 then break;
           lpBuffer[dwBytesRead] := #0;
           Form1.Memo1.Lines.Add(lpBuffer);
         end;
         Result := True;
       finally
         InternetCloseHandle(hService);
       end;
   end;
 finally
   InternetCloseHandle(hSession);
 end;
end;


 
Fredy314 ©   (2007-03-04 09:26) [4]

или

{Forces a download of the requested file, object, or directory
listing from the origin server, not from the cache}

function DownloadURL_NOCache(const aUrl: string; var s: String): Boolean;
var
  hSession: HINTERNET;
  hService: HINTERNET;
  lpBuffer: array[0..1024 + 1] of Char;
  dwBytesRead: DWORD;
begin
  Result := False;
  s := "";
  // hSession := InternetOpen( "MyApp", INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
 hSession := InternetOpen("MyApp", INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  try
    if Assigned(hSession) then
    begin
      hService := InternetOpenUrl(hSession, PChar(aUrl), nil, 0, INTERNET_FLAG_RELOAD, 0);
      if Assigned(hService) then
        try
          while True do
          begin
            dwBytesRead := 1024;
            InternetReadFile(hService, @lpBuffer, 1024, dwBytesRead);
            if dwBytesRead = 0 then break;
            lpBuffer[dwBytesRead] := #0;
            s := s + lpBuffer;
          end;
          Result := True;
        finally
          InternetCloseHandle(hService);
        end;
    end;
  finally
    InternetCloseHandle(hSession);
  end;
end;

//aufrufen
var
  s: String;
begin
 if DownloadURL("http://www.swissdelphicenter.ch/", s) then
   ShowMessage(s);
end;


 
arturich ©   (2007-03-04 16:59) [5]

спасибо всем, это оказывается двумя строчками делается )



Страницы: 1 вся ветка

Форум: "Начинающим";
Текущий архив: 2007.03.25;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.46 MB
Время: 0.04 c
2-1173029290
hypno
2007-03-04 20:28
2007.03.25
Как отследить нажатие клавиш


6-1160383751
Альберт
2006-10-09 12:49
2007.03.25
Отправить данные POST ом


15-1172584054
Сатир
2007-02-27 16:47
2007.03.25
Тут просили сводить на холивар по ЯПам


3-1167388919
reb00ter
2006-12-29 13:41
2007.03.25
Обработка потери соединения с сервером


15-1172611365
Gero
2007-02-28 00:22
2007.03.25
Лебедев облажался





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский