How to get external JSON with PHP that has content-type text/plain? -
i trying fetch external json response php back-end problem external endpoint returned content-type: text/plain;charset=utf-8, , gives me gibberish when read it.
string '����������ݒ�j�� ... etc...
is there way encode response?
this have done:
$response = file_get_contents('external_url');
i have tried this:
$json = json_decode(file_get_contents('external_url'), true);
it doesn't matter php content-type
response declares, doesn't do information. you're getting same response body whether header says text/plain
or json.
more response compressed , need uncompress gzinflate
or such.
Comments
Post a Comment