Skip to main content
deleted 23 characters in body; edited tags
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64

unable Unable to decode html entitlesHTML entities in the API response?

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

unable to decode html entitles

I am trying to decode html entity from json data that i am receiving with Stack Exchange api but its not working

I have used both html_entity_decode and htmlspecialchars_decode but id doesn't effect anything.

Here is the 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

Unable to decode HTML entities in the API response?

I am trying to decode HTML entities from the JSON data returned by the Stack Exchange API but it's not working.

I have used both html_entity_decode and htmlspecialchars_decode but it doesn't effect anything.

Here is the PHP code:

<?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(); 
}
?>
Source Link
Skyyy
  • 111
  • 3

unable to decode html entitles

I am trying to decode html entity from json data that i am receiving with Stack Exchange api but its not working

I have used both html_entity_decode and htmlspecialchars_decode but id doesn't effect anything.

Here is the 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