getMFAResponseForSite - 将数组渲染为验证码图像

时间:2014-06-24 14:06:04

标签: arrays json image captcha yodlee

我正在与Yodlee MFA合作,在本例中是验证码,我想知道如何从这个JSON响应中渲染图像字段:

{
   "isMessageAvailable":true,
   "fieldInfo":{
      "responseFieldType":"text",
      "imageFieldType":"image",
      "image":[
         66,
         77,
         58,
         116,
         0,
         0,
         0,
         0,
         0,
         0,
         54,
         0,
         0,
         0,
         40,
         0,
         0,
         0,
         -91,
         0,
         0,
         0,
         45,
         0,
         0,
         0,
         1,
         0,
         32,
         0,
         0,
         0,
         0,
         0,
         4,
         116,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -5,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -9,
         -9,
         -9,
         0,
         -1,
         -5,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -5,
         -1,
         0,
         -17,
         -17,
         -17,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -9,
         -13,
         -9,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -9,
         -9,
         -9,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -17,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0,
         -1,
         -1,
         -1,
         0
      ],
      "minimumLength":-1,
      "maximumLength":-1,
      "displayString":"Please enter the text shown in the image"
   },
   "timeOutTime":99900,
   "itemId":10014925,
   "retry":false
}

有关详细信息,请阅读以下链接: Link1Link2

我很感激任何帮助,因为我问了一个Yodlee代表,他指示我来这里。

2 个答案:

答案 0 :(得分:0)

CAPTCHA图像以字符串形式返回,字符串是图像的字节数组。您需要将此字符串转换为字节数组,然后转换为图像。您可以使用JDK库来完成此操作,即不需要外部库。

您可以使用这些。

java.awt.image.BufferedImage;
java.io.BufferedReader;
java.io.ByteArrayInputStream;

答案 1 :(得分:0)

对我而言,这是一个最佳解决方案:

$string = implode(array_map("chr", $image));

在这里您可以找到不同的实现: How can I convert array of bytes to a string in PHP?

相关问题