Try this simple routine:
function DownloadURL_NOCache(const aUrl: string;
var s: String;
Progress: cbProgressBar): Boolean;
Const
sBUF = 32000; // 1024
var
hSession: HINTERNET;
hService: HINTERNET;
lpBuffer: array[0..sBUF + 1] of Char;
dwBytesRead: DWORD;
i: LongInt;
begin
Result := False;
s := '';
i := 0;
if Progress <> nil then
Progress(aURL, i);
// hSession := InternetOpen( 'MyApp', INTERNET_OPEN_TYPE_DIRECT, nil, nil, 0);
hSession := InternetOpen('MyApp',
INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
try
if Assigned(hSession) then
begin
hService := InternetOpenUrl(hSession, PChar(aUrl), nil, 0,
INTERNET_FLAG_RELOAD, 0);
if Assigned(hService) then
try
while True do
begin
dwBytesRead := sBuf;
InternetReadFile(hService, @lpBuffer, sBUF, dwBytesRead);
if dwBytesRead = 0 then break;
lpBuffer[dwBytesRead] := #0;
s := s + lpBuffer;
I := i + 1;
if i > 99 then i := 1;
if Progress <> nil then
Progress(aURL, i);
end;
Result := True;
finally
InternetCloseHandle(hService);
end;
end;
finally
InternetCloseHandle(hSession);
if Progress <> nil then
Progress(aURL, 99);
end;
end;