if HTTP.HTTPMethod('GET', 'http://10.10.0.1/file1.txt') then
// more code
if HTTP.HTTPMethod('GET', 'http://10.10.0.1/file1.exe') then
AFAIK, "Bad Request" is when the URL is malformed. I copy/pasted it on a browser and it worked fine. Also, the first file loads fine. Any hint?
Alex
2006/3/11, Julio C. Taborda <[EMAIL PROTECTED]>:
El Sun, 12 Mar 2006 00:21:15 +0100
bobby <[EMAIL PROTECTED]> escribió:
> My app need to download one file from the internet, and thats all.
> Can someone explain to me how to do this?
> regards
> bobby
You can use synapse (www.ararat.cz/synapse)
***********************************************
<sample app>
{$MODE DELPHI}
Program testhttp;
uses
httpsend, classes;
var
HTTP: THTTPSend;
l: tstringlist;
begin
HTTP := THTTPSend.Create;
l := TStringList.create;
try
if not HTTP.HTTPMethod ('GET', Paramstr(1)) then
//replace paramstr(1) with an url or run program with url argument
begin
writeln('ERROR');
writeln(Http.Resultcode);
end
else
begin
writeln( Http.Resultcode, ' ', Http.Resultstring);
writeln;
writeln(Http.headers.text);//writes the headers if your need
writeln;
l.loadfromstream(Http.Document);
l.savetofile ('test.htm');
writeln(l.text);
end;
finally
HTTP.Free;
l.free;
end;
end.
___________________________________________________________
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
--
Atenciosamente,
Alexsander da Rosa