Вот как разобрать этот json
<?php
$json = '[{
"issuedTime":"7:13pm Sunday 13 June 2010",
"text":"\nAmended 7:10pm.\n\nText text and more text\n",
"url":"\/folder\/fc\/name.png",
"validToTime":"12:00am Monday 14 June 2010"
},{
"issuedTime":"8:33pm Sunday 13 June 2010",
"text":"\nText and more text.\n",
"url":"\/folder\/fc\/name.png",
"validToTime":"12:00pm Monday 14 June 2010"
},{
"issuedTime":"10:40am Sunday 13 June 2010",
"text":"\nAnd even more text.",
"url":"\/folder\/fc\/name.png",
"validToTime":"12:00am Tuesday 15 June 2010"
}]';
// Parse the json into a PHP array that holds multiple "stdClass Object"s
$obj = json_decode($json);
// Iterate through each "stdClass Object" and show what it contains
foreach($obj as $var => $value)
{
echo "Number: $var <br/>";
echo "Issued: " . $obj[$var]->issuedTime . "<br/>";
echo "Text: " . $obj[$var]->text . "<br/>";
echo "URL: " . $obj[$var]->url . "<br/>";
echo "Valid to: " . $obj[$var]->validToTime . "<br/>";
echo "<br/>";
}
?>
Получив $ obj, вы можете получить к нему доступ, как в цикле foreach выше, или для доступа, скажем, к тексту во втором листинге, который вы используете:
echo $obj[1]->text; // Second listing, since the first listing is $obj[0]
И HTML-ссылка с текстом для того же:
echo '<a href="' . $obj[1]->url . '">' . $obj[1]->text . '</a>';