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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -