پرتال مراکز دیجیتال

تازه ها

[insert_php]

$jsonurl=”http://book.amfm.ir/rest/news/bibliographic/listBiblio”;

try {
$context = stream_context_create(
array(
‘http’ => array(
‘follow_location’ => true,
‘max_redirects’ => ۲۰
),
“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 ‘

‘;
echo “” ;
if(($datajson[‘newItemsEntity’][‘materialType’]==”BF”)||($datajson[‘newItemsEntity’][‘materialType’]==”BL”)) echo “ “;
if(($datajson[‘newItemsEntity’][‘materialType’]==”VF”)||($datajson[‘newItemsEntity’][‘materialType’]==”VL”)) echo “ “;
if(($datajson[‘newItemsEntity’][‘materialType’]==”AF”)||($datajson[‘newItemsEntity’][‘materialType’]==”AL”)) echo “ “;
if(($datajson[‘newItemsEntity’][‘materialType’]==”TF”)||($datajson[‘newItemsEntity’][‘materialType’]==”TL”)) echo “ “;
if(($datajson[‘newItemsEntity’][‘materialType’]==”PF”)||($datajson[‘newItemsEntity’][‘materialType’]==”PL”)) echo “ “;
if(($datajson[‘newItemsEntity’][‘materialType’]==”DF”)||($datajson[‘newItemsEntity’][‘materialType’]==”DL”)) echo “ “;
echo $datajson[‘newItemsEntity’][‘title’].”

“;
echo ‘

‘;
echo “

“;
break;
default:
foreach ($datajson[‘newItemsEntity’] as $keyjson => $valuejson)
{
echo ‘

“;
}
}

}

if ($resultjson === false) {
echo “ziro”;
}
} catch (Exception $ex) {
echo “Exception”;
}

[/insert_php]