I am trying to decode html entityHTML entities from jsonthe JSON data that i am receiving withreturned by the Stack Exchange apiAPI but itsit's not working.
I have used both html_entity_decode
and htmlspecialchars_decode
but idit doesn't effect anything.
Here is the PHP code i am using:
<?php
header("Content-Type: application/json");
header("Content-Encoding: gzip");
if(isset($_REQUEST['id']) && !empty($_REQUEST['id'])){
$id= $_REQUEST['id'];
$url = "https://api.stackexchange.com/2.2/questions/".$id."?site=stackoverflow&filter=withBody";
$data = file_get_contents($url);
echo html_entity_decode($data);
//echo htmlspecialchars_decode($data);
//echo $data;
exit();
}
else{
echo "Question id not available";
exit();
}
?>
I am using php