Freebase API call works in browser but fails with curl
My guess is that you are seeing NULL
because the curl_exec
returns false
and then the json_decode
converts the false
to NULL
.
This means, as you suspected, that curl_exec
is failing. I'm not sure why, but I would start by debugging with curl_error() and curl_errno() to get more information on what is causing curl to fail.
Reference: curl_exec() always returns false