获取网页
问题描述:
可能重复:
Downloading a file in Delphi
Delphi File Downloader Component获取网页
大家好, 我试图开发一个Delphi 7应用程序,它可作为一种货币数据库或者接近它的东西(不要问我为什么,我只是为了赚钱:))。因此当前的任务是从服务器下载包含货币列表的网页并将该列表提取到数据库。 是否有可能以及需要使用哪些工具来加以解决?我知道PHP,但PHP编写GUI似乎一些疯狂)
答
为了增加安德烈亚斯评论,你还可以检查出Delphi.About.com,有一个例子那里下载一个文件,并显示一个进度:http://delphi.about.com/cs/adptips2003/a/bltip0903_2.htm
“如果您需要将指定URL的内容保存到文件中并且能够跟踪下载进度,请使用TDownLoadURL Delphi动作 TDownLoadURL正在写入指定文件时,它会定期生成一个OnDownloadProgress事件,以便您可以向用户提供关于该过程的反馈。 下面是一个示例 - 请注意,您必须在使用条款中包含单元ExtActns。“
uses ExtActns, ...
type
TfrMain = class(TForm)
...
private
procedure URL_OnDownloadProgress
(Sender: TDownLoadURL;
Progress, ProgressMax: Cardinal;
StatusCode: TURLDownloadStatus;
StatusText: String; var Cancel: Boolean) ;
...
implementation
...
procedure TfrMain.URL_OnDownloadProgress;
begin
ProgressBar1.Max:= ProgressMax;
ProgressBar1.Position:= Progress;
end;
function DoDownload;
begin
with TDownloadURL.Create(self) do
try
URL:='http://0.tqn.com/6/g/delphi/b/index.xml';
FileName := 'c:\ADPHealines.xml';
OnDownloadProgress := URL_OnDownloadProgress;
ExecuteTarget(nil) ;
finally
Free;
end;
end;
http://*.com/questions/3506251/downloading-a-file-in-delphi,http://*.com/questions/4521535/delphi-file-downloader-component,等等 – 2011-05-15 10:32:09