sorry if my question is silly but there’s something I’m not getting.
I’m using Guzzle in a PHP process to make an API call.
$response = $this->client->request('GET', 'droits_acces', [
'stream' => true,
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/x-ndjson',
]
]);
But I don’t understand how to interpret the response. I found this library for interpret ndjson: https://github.com/sunaoka/ndjson
My logic was to take the response content, store it in a temporary file, and then read it using the library.
But when I use $response->getBody()->getContents() I get a response with a lot of line breaks. However, in NDJSON, the line breaks represent the separation between one object and another, if I understand correctly.
I’m a bit confused right now. If anyone has any tips or suggestions on how to proceed, that would be really helpful =D
Thank you in advance!
Florian B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.