<?
$jsonString = '{"meta":{"status":200,"msg":"OK"},"response":{"blog":
{"title":"happiness.","posts":12215,"name":"random","url":"http:\/\/www.demo.com\/","updated":1354380368,"description":"","ask":true,"ask_anon":true,"share_likes":true,"likes":166 1}}}';
$jsonObject = json_decode($jsonString);
$result = '';
foreach ($jsonObject->response as $blog) {
$result .= $blog->title . ' - ' . $blog->url . '<br/>' . "\n";
}
echo $result;
?>
Since $blog->url . returns a url, how can I put this url in an anchor tag?
Wrap it with the anchor tag, calling
urlencode()to ensure URL characters are properly encoded: