![]() |
curl lib response getBody return binary string - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: curl lib response getBody return binary string (/showthread.php?tid=76510) |
curl lib response getBody return binary string - sandip002 - 05-19-2020 Today I'm trying to fetch some testing data from "https://jsonplaceholder.typicode.com/todos/1", but when I get a response and try to get data it will give binary string. Code: $this->client = \Config\Services::curlrequest([ output: Code: ���RPP*-N-�LQ�R0�q3̒̒�T%+��Ԝ���b���N�U+H��-�I-IiIK�)N�7��S is anything I'm doing wrong. EDIT: I'm trying to get data in json or array format from api. ALREADY TRIED THINGS: Code: $data = $this->client->get('/todos/1'); RE: curl lib response getBody return binary string - InsiteFX - 05-19-2020 Did you try this? PHP Code: $data = json_decode($this->client->get('/todos/1')); |