PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- function parse_rss($reg_exp, $xml_data) {
- 'count'=>count($temp[0]),
- 'title'=>$temp[1],
- 'link'=>$temp[2],
- 'desc'=>$temp[3]
- );
- }
- function output_rss($pattern, $rss_data, $count_latest) {
- $temp = null;
- for($i = 0; $i < $count_latest; $i++) {
- $rss_data['link'][$i],
- );
- }
- return $temp;
- }
- $url = 'http://voicesevas.ru/rss.xml';
- $reg_exp ='#<item>.*?<title>(.*?)<\/title>.*?';
- $reg_exp .='<link>(.*?)<\/link>.*?<description>';
- $reg_exp .='(.*?)<\/description>.*?<\/item>#si';
- $pattern = '<a href="%s">%s</a><br>%s<hr>';
- $rss_data = parse_rss($reg_exp, $xml_data);
- echo output_rss($pattern, $rss_data, 8);
- }
- ?>