I am getting all the post data from my blogger, but when I output data there are some special characters are not being displayed with json_decode. I also tried json_encode($resp, JSON_UNESCAPED_UNICODE). But it still didn't work, how will I convert them ? Please see the output below
<?php
$blogId = '123';
$appId = 'abc';
$url = "https://www.googleapis.com/blogger/v3/blogs/{$blogId}/posts?key=
{$appId}";
try{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$resp = curl_exec($ch);
curl_close($ch);
$posts = json_decode($resp, true);
$allposts = array();
echo "<pre>";
foreach ($posts['items'] as $post) {
array_push($allposts, array(
"title" => $post['title'],
"published" => $post['published'],
"updated" => $post['updated'],
"labels" => $post['labels'][0]
));
}
print_r($allposts);
echo "</pre>";
}catch(Exception $ex){
echo $ex->getMessage();
}
?>
OUTPUT
[title] => Notes of Class 9th: Ch 3 परमाणॠà¤à¤µà¤‚ अणॠविजà¥à¤žà¤¾à¤¨