authorize.net json return extra characters

后端 未结 2 663
清酒与你
清酒与你 2021-01-19 15:44

I have this code

$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HTTPHEAD         


        
2条回答
  •  自闭症患者
    2021-01-19 16:20

    I encountered the same issue when developing my library for accessing their JSON API. In the code that handles the response I had to strip those characters out in order to properly decode the string as JSON.

    Line 113:

    $this->responseJson = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $responseJson);
    

提交回复
热议问题