unigui图形验证码
procedure TMainForm.UniButton1Click(Sender: TObject);
var
url: SockString;
serial: TynSerial;
i: Integer;
ms: TMemoryStream;
begin
serial := TynSerial.Create;
ms := TMemoryStream.Create;
try
url := 'verifycode';
i := FHttp.Post(url, '', 'text/plain; charset=UTF-8');
if i = 200 then
begin
serial.Text := FHttp.Content;
UniEdit1.Text := serial.ReadString('code');
serial.ReadStream('image', ms);
ms.Position := 0;
UniImage1.LoadFromStream(ms);
end
else
ShowMessage(i.ToString + ' error');
finally
serial.Free;
ms.Free;
end;
end;