Ich habe es gerade versucht, leider klappt es bis jetzt nicht. Wieder die gleiche
Exception:
Stelle 1949:
raise EIdConnClosedGracefully.Create(RSConnectionClosedGracefully);
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
xml: TStrings;
response: TStringStream;
SendStream: TStream;
TextToCheck:
String;
begin
TextToCheck := '
Teest';
// das Wort welches geprüft / korrigiert werden soll
xml := TStringList.Create;
response := TStringStream.Create('
');
SendStream := TMemoryStream.Create;
try
xml.Add('
<?xml version="1.0" encoding="UTF-8"?>');
xml.Add('
<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">');
xml.Add('
<text>' + TextToCheck + '
</text>');
xml.Add('
</spellrequest>');
IdHTTP1.Request.Accept := '
*/*';
IdHTTP1.Request.ContentType := '
text/xml';
IdHTTP1.Request.Connection := '
Keep-Alive';
IdHTTP1.HandleRedirects := True;
SendStream.
Write(
xml.Text[1], Length(
XML.Text));
SendStream.Position := 0;
try
IdHTTP1.Post('
http://www.google.com/tbproxy/spell?lang=de', SendStream, response);
ShowMessage(response.DataString);
except
on E:
Exception do
ShowMessage('
Fehler: ' + E.
Message);
end;
finally
FreeAndNil(response);
FreeAndNil(
xml);
FreeAndNil(SendStream);
end;
end;