IdTCPClient : Récupérer fichier HTTP ?
Bonjour,
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
procedure TForm1.Button1Click(Sender: TObject);
var
sLigne : string;
begin
IdTCPClient1.Host := 'google.fr';
IdTCPClient1.Port := 80;
try
IdTCPClient1.Connect;
IdTCPClient1.IOHandler.WriteLn('GET / HTTP/1.1'#13#10);
repeat
sLigne := IdTCPClient1.IOHandler.ReadLn;
Memo1.Lines.Add(sLigne);
until sLigne = '';
except
on E : Exception do
begin
MessageDlg(E.Message, mtError, [mbOK], 0);
end;
end;
end; |
Il me donne le resultat suivant :
Citation:
HTTP/1.1 302 Found
Location:
http://www.google.fr/
Cache-Control: private
Set-Cookie: PREF=ID=65066b3f703fb3ad:TM=1160779425:LM=1160779425:S=BQFp8wOrDIo6it0F; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
Content-Type: text/html
Server: GWS/2.1
Content-Length: 218
Date: Fri, 13 Oct 2006 22:43:45 GMT
Je souhaiterai récupérer le code source de la page ou du fichier, comment dois-je faire ?
Merci d'avance,
Mathieu