Yes, json_decode should only be passed JSON data for decoding. Since you are using curl, you can simply tweak the request so that it does not return headers with something like
curl_setopt($ch, CURLOPT_HEADER, false);
Update: if you need headers for earlier processing, then the above will not cut. However, you can easily remove them at any time, taking advantage of the fact that there will be a double delimiter between the header and the response body. Using explode like this, then select the body:
list(,$body) = explode("\n\n", $response, 2);
source share