Ausgehend von diesem Post
http://www.delphipraxis.net/1365797-post2.html
Statt:
Delphi-Quellcode:
Try
idHttp1 := TIdHTTP.Create;
responseStream := TMemoryStream.Create;
Screen.Cursor := crHourGlass;
try
IdHTTP1.Get(sUrlLong, responseStream);
IdHTTP1.Disconnect(True);
except on E: EIdException Do
FormMain.add_info('UST Abfrage gescheitert '+E.Message);
end;
SetString(resultstring, PAnsiChar(responseStream.Memory), responseStream.Size);
Finally
idHttp1.Free;
responseStream.Clear;
responseStream.Free;
Screen.Cursor := crDefault;
End;
mache mal einfach das:
Delphi-Quellcode:
var
sl : TStringList;
i : Integer;
sErrorCode : String;
begin
...
Try
idHttp1 := TIdHTTP.Create;
sl := TStringList.Create;
Screen.Cursor := crHourGlass;
try
sl.Text := IdHTTP1.Get(sUrlLong);
IdHTTP1.Disconnect(True);
i := sl.IndexOf('<value><string>ErrorCode</string></value>');
if i > -1 then begin
sErrorCode := sl[i + 1];
sErrorCode := AnsiReplaceText(sErrorCode,'<value><string>','');
sErrorCode := AnsiReplaceText(sErrorCode,'</string></value>','');
end;
except on E: EIdException Do
FormMain.add_info('UST Abfrage gescheitert '+E.Message);
end;
Finally
sl.Free;
idHttp1.Free;
Screen.Cursor := crDefault;
End;