I want to read the ini file of a website, but I can not. I tried this way:
inicheck := 'http://pokestage.ddns.net/patch/CHECK.INI';
conf2 := TIniFile.Create(IdHTTP3.Get(inicheck));
version2 := conf2.ReadString('CONFIG', 'TVERSION', '');
But it is not working. How should it be done?
I tested it like this:
var
conf2 : TIniFile;
version2 : string;
inicheck : string;
path : string;
tempfile : TFileStream;
begin
path := extractFilepath(application.exename);
inicheck := 'http://pokestage.ddns.net/patch/CHECK.INI';
tempfile := TFileStream.Create('SCHECK.INI', fmCreate);
try
tempfile.Position:=0;
IdHTTP3.Get(inicheck, tempfile);
tempfile.Free;
conf2 := TIniFile.Create(path+'\SCHECK.INI');
version2 := conf2.ReadString('CONFIG', 'TVERSION', '');
finally
conf2.Free;
end;
ShowMessage('Client '+version);
ShowMessage('Servidor '+version2)
And it did not, I did not see any difference between mine and yours. The client, it worked, being the same thing.
Edit: I got it, I was putting tempfile.free; in the wrong place, it has to close before creating the ini. I already set the example.