src/Service/Aliyun/OCRManager.php
public function request($url, $images, array $options = [])
    {
        $httpClient = (new Http)->setHeaders($this->appcode->getAppCodeHeader());

        try {
            $response = $httpClient->json($url, $this->getFixedFormat($images, $options));
        } catch (\GuzzleHttp\Exception\ClientException $e) {
            if ($e->hasResponse()) {
                $response = $e->getResponse();
            }
        }

        //reset flag
        $this->simpleRequestBody = false;

        if ($response->getStatusCode() != 200) {
            $requestID = $response->getHeader('X-Ca-Request-Id');
            $messages  = $response->getHeader('X-Ca-Error-Message');

            $messages = empty($messages[0]) ? $response->getBody()->getContents() : $messages[0];

            return [
                'request_id' => current($requestID),
                'error_msg' => $messages,
            ];
        }


        $arr = $httpClient->parseJson($response);
  
        if (isset($arr['success']) && $arr['success'] === true) {
            return $arr;
        }

        if (! is_array(Arr::get($arr, 'outputs.0.outputValue.dataValue'))) {
            $arr['outputs'][0]['outputValue']['dataValue'] = json_decode($arr['outputs'][0]['outputValue']['dataValue'], true);
        }

        return $arr;
    }
public function request($url, $images, array $options = [])
    {
        $httpClient = (new Http)->setHeaders($this->appcode->getAppCodeHeader());

        try {
            $response = $httpClient->json($url, $this->getFixedFormat($images, $options));
        } catch (\GuzzleHttp\Exception\ClientException $e) {
            if ($e->hasResponse()) {
                $response = $e->getResponse();
            }
        }

        //reset flag
        $this->simpleRequestBody = false;

        if ($response->getStatusCode() != 200) {
            $requestID = $response->getHeader('X-Ca-Request-Id');
            $messages  = $response->getHeader('X-Ca-Error-Message');

            $messages = empty($messages[0]) ? $response->getBody()->getContents() : $messages[0];

            return [
                'request_id' => current($requestID),
                'error_msg' => $messages,
            ];
        }


        $arr = $httpClient->parseJson($response);
  
        if (isset($arr['success']) && $arr['success'] === true) {
            return $arr;
        }

        if (! is_array(Arr::get($arr, 'outputs.0.outputValue.dataValue'))) {
            $arr['outputs'][0]['outputValue']['dataValue'] = json_decode($arr['outputs'][0]['outputValue']['dataValue'], true);
        }

        return $arr;
    }
Request

@param  string $url
@param  mixed $images
@param  array  $options

@return array