I have the following problem, I have a function in Delphi that executes Online a PHP file that provides the SERIAL of the PROGRAM It happens, that when I execute this function it gets the same SERIAL, because it is in the CACHE of the Machine. I know there is a FLAG that does RELOAD on WinInet, something similar to clear the cache, some help?
Follow my code:
function DownloadSerial(const Origem: string): string;
var
SessaoHandle, UrlHandle : Pointer;
TamanhoDados : DWORD;
Dados : Array[0..1024] of Char;
ABC: HMODULE;
begin
Result := '';
if (not Assigned(@InternetOpenA) or not Assigned(@InternetOpenUrlA) or not Assigned(@InternetReadFile) or not Assigned(@InternetCloseHandle)) then
begin
ABC := LoadLibrary( pChar('wininet.dll')) );
if ABC <> 0 then
begin
@InternetOpenA := GetProcAddress(ABC, pChar('InternetOpenA')));
@InternetOpenUrlA := GetProcAddress(ABC, pChar('InternetOpenUrlA')));
@InternetReadFile := GetProcAddress(ABC, pChar('InternetReadFile')));
@InternetCloseHandle := GetProcAddress(ABC, pChar('InternetCloseHandle')));
end;
end;
if (Assigned(@InternetOpenA) and Assigned(@InternetOpenUrlA) and Assigned(@InternetReadFile) and Assigned(@InternetCloseHandle)) then
begin
SessaoHandle := InternetOpenA(nil, 0, nil, nil, 0);
UrlHandle := InternetOpenUrlA(SessaoHandle, pChar(Origem), nil, 0, 0, 0);
if UrlHandle <> nil then
begin
repeat
InternetReadFile(UrlHandle, @Dados, SizeOf(Dados), TamanhoDados); //saida := saida + lpBuffer;
Result := Result + string(Dados);
until TamanhoDados = 0;
end;
InternetCloseHandle(UrlHandle);
InternetCloseHandle(SessaoHandle);
end;
end;