Monday, Oct 14 Week 42

Page 1 of 1  
Showing no. 1 to 2 of 2 items

Delphi: Download file from internet using INDY. Customize the parameters for timeout and redirects. It saves the file to a given location using stream. uses windows,sysUtils,idHttp; const NONE = $00; //Blank number INET_USERAGENT = 'Mozilla/4.0, Indy Library (Windows; en-US)'; INET_REDIRECT_MAX = 10; function forceDeleteFile(pFileName:pAnsiChar):boolean; begin windows.setFileAttributes(pFileName,NONE);//clear file attributes result:=windows.deleteFile(pFileName); //then delete the file

Delphi: Download HTML-source from internet as text. Customize the parameters for timeout and redirects. It returns the destination URL when navigating is done. uses idHttp; const INET_USERAGENT = 'Mozilla/4.0, Indy Library (Windows; en-US)'; INET_TIMEOUT_SECS = 3; INET_REDIRECT_MAX = 10; function downloadSrc(var aUrl:ansiString):ansiString; begin with tIdHttp.create(nil) do begin //Create Indy http object request.userAgent:=INET_USERAGENT; //Custom user agent string