چاپ خبر
دبیرستان پسرانه شهید بهشتی جمعه, ۰۲ خرداد ۱۳۹۹
rss
]*>(.*?)<\/\\1>/s'; preg_match_all($regexp, $text, $match); $loop = 0; foreach($match[1] as $key=>$val){ if(preg_match($regexp, $match[2][$key])){ @$array[$val][$loop] = xmlToArray($match[2][$key]); } else { @$array[$val] = $match[2][$key]; } $loop++; } return $array; } //آماده سازی فید جهت ایجاد خروجی function displayFeed($url, $num){ $template = '
» #title#
#description#
#pubDate#
' . "\n"; if($rss = @file_get_contents($url)){ $rss = xmlToArray($rss); if(is_array($rss)){ $code = ""; $count = 0; foreach($rss['rss'][0]['channel'][0]['item'] as $val){ $tpl = strtolower($template); foreach($val as $key => $val2){ $val2 = html_entity_decode(htmlentities(@strip_tags($val2))); $tpl = str_replace("#" . strtolower($key) . "#", $val2, $tpl); } if($count < $num){ $code .= $tpl; } ++$count; } } else { return false; } echo $code; return true; } else { return false; } } //چاپ خروجی echo '
' . "\n"; displayFeed("$url", $num); echo '
'; ?>
انتهای پیام/.