Ver Mensaje Individual
  #2  
Antiguo 12-04-2008
Avatar de Black_Ocean
Black_Ocean Black_Ocean is offline
Miembro
 
Registrado: nov 2006
Posts: 128
Reputación: 18
Black_Ocean Va por buen camino
Bueno, te diré el camino fácil:

1. Descargar el componente HTTPGet, que es para bajar cualquier tipo de archivo (binarios, zip, HTML, etc) de Internet desde direcciones de tipo HTTP (es gratuito y está basado en la librería WinInet.dll de Windows, lo uso bastante por su estabilidad y eficiencia). http://www.delphi32.com/vcl/2203/

2. Una vez descargado, Instalar el componente.

3. Ejemplo básico de uso: Inserta un componente TButton, un TMemo y un THTTPGet en el formulario y usa el siguiente código que he hecho:

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, HTTPGet;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    HTTPGet1: THTTPGet;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

const
  sURL = 'http://www.turboexplorer.com/delphi';
  sDestino = 'C:\pagina.html';

procedure TForm1.FormCreate(Sender: TObject);
begin
  HTTPGet1.WaitThread := True;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  HTTPGet1.FileName := sDestino;
  HTTPGet1.URL := sURL;
  try
    HTTPGet1.GetFile;
  finally
    if FileExists(sDestino) then
      Memo1.Lines.LoadFromFile(sDestino);
  end;
end;

end.

Saludos y buena suerte =)

Última edición por Black_Ocean fecha: 12-04-2008 a las 07:34:53.
Responder Con Cita