[insert_php]
$jsonurl=”http://book.amfm.ir/rest/news/bibliographic/listBiblio”;
try {
$context = stream_context_create(
array(
‘http’ => array(
‘follow_location’ => true,
‘max_redirects’ => 20
),
“ssl”=>array(
“verify_peer”=>false,
“verify_peer_name”=>false,
)
)
);
$resultjson = file_get_contents(‘http://book.amfm.ir/rest/news/bibliographic/listBiblio’,false,$context);
$datajson = json_decode($resultjson,true);
echo ‘
‘;
if (isset($datajson[‘totalResult’])) {
$datajson[‘totalResult’] = $datajson[‘totalResult’];
}
else {
$datajson[‘totalResult’] = 0;
}
if (is_array($datajson[‘newItemsEntity’])) {
switch ($datajson[‘totalResult’]) {
case 1:
echo ‘
“;
break;
default:
foreach ($datajson[‘newItemsEntity’] as $keyjson => $valuejson)
{
echo ‘
“;
}
}
}
if ($resultjson === false) {
echo “ziro”;
}
} catch (Exception $ex) {
echo “Exception”;
}
[/insert_php]