Error 500 json request on php but not on Browser

I’m using kirby provides the content via json
e.g.: “” - returns a folio json obj
that works very well when the frontend requests it, or if I type that url on the browser

but it fails (error 500) if I try to use it on a php file:
e.g: make the request on my, using:

any idea why?

Maybe this SO answer helps: