PHP script showing HTML inside JSON -


i have created php scipt test external system returning json string. there html inside json. have tried setting header ain't working.

here code.

header("content-type: application/json"); echo "{\"carname\":\"audi\",\"carprice\": \"100000usd\"}"; 

you can try , tell browser ignore tracking injected code, there's no guarantee hosting isn't rewriting header also, manipulating content-length:

$payload = json_encode( your_array );  header('content-type: application/json;charset=utf-8"); header('content-length: ' . strlen($payload)); die($payload); 

the solution, however, either different hosting or contact them (there's sorts of hosted frameworks need proper json sent php: none of them working there? find difficult believe) , ask how not injected trackers.


Comments