Jump to content

call a web service


jasaad

Recommended Posts

I used to call a web service like this...

    IdHTTP1 := TIdHTTP.Create(nil);
    IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';

    MPData := TIdMultiPartFormDataStream.Create;
    MPData.AddFile('file', Image_File_path, 'image/jpg');
    MPData.AddFormField('apikey', 'xxxxxxxxxxx');
    MPData.AddFormField('language', 'eng');
    MPData.AddFormField('isOverlayRequired', 'False');

    sResponse := IdHTTP1.Post('https://api.ocr.space/parse/image', MPData);

    JsonObject := TJSONObject.Create;
    JsonValue := JsonObject.ParseJSONValue(sResponse);
    JsonValue:=(JsonValue as TJSONObject).Get('ParsedResults').JSONValue;

    if (JsonValue is TJSONArray) then
      sValue := ((JsonValue as TJSONArray).Items[0] as TJSonObject).Get('ParsedText').JSONValue.Value;

    UniMemo1.Lines.Add(sValue);

 

how to do the same using UNIGUI application?

Link to comment
Share on other sites

  • 2 months later...
×
×
  • Create New...