Вот как получить строку из HTTP-запроса GET:
function WebGetData(const UserAgent: string; const Server: string;
const Resource: string): string; overload;
var
hInet: HINTERNET;
hURL: HINTERNET;
Buffer: array[0..1023] of AnsiChar;
i, BufferLen: cardinal;
begin
result := '';
hInet := InternetOpen(PChar(UserAgent), INTERNET_OPEN_TYPE_PRECONFIG,
nil, nil, 0);
if hInet = nil then RaiseLastOSError;
try
hURL := InternetOpenUrl(hInet, PChar('http://' + Server + Resource),
nil, 0, 0, 0);
if hURL = nil then RaiseLastOSError;
try
repeat
InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen);
if BufferLen = SizeOf(Buffer) then
result := result + AnsiString(Buffer)
else if BufferLen > 0 then
for i := 0 to BufferLen - 1 do
result := result + Buffer[i];
until BufferLen = 0;
finally
InternetCloseHandle(hURL);
end;
finally
InternetCloseHandle(hInet);
end;
end;
Это то, как мое собственное программное обеспечение AlgoSim проверяет наличие обновлений.Попробуйте, например,
ShowMessage(WebGetData('My User Agent', 'services.rejbrand.se',
'/algosim/update/ver.asp'));