Antuan, ahora que ya casi tienes el código, te recomiendo que avances al paso siguiente y crees una clase a que resuelva tu problema.
Aca te dejo algunas correcciones a tu código (los comentarios son todos códigos que no deben ir):
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Sockets, ScktComp;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Edit1: TEdit;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
ClientSocket1: TClientSocket;
procedure PeticionWeb(url: string);
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ClientSocket1 := TClientSocket.Create(Self);
ClientSocket1.ClientType := ctNonBlocking;
ClientSocket1.Port := 80;
ClientSocket1.OnRead:= ClientSocket1Read;
ClientSocket1.Active := False;
end;
procedure TForm1.PeticionWeb(url: string);
begin
result:= ' ';
with ClientSocket1.Socket do
begin
Memo1.Clear;
ClientSocket1.Host := url;
ClientSocket1.Active := True;
SendText('GET / HTTP/1.0'+#13#10);
SendText(''+#13#10);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
PeticionWeb(Edit1.Text);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
begin
memo1.Lines.Add(ClientSocket1.Socket.ReceiveText);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ClientSocket1.Free;
end;
end.