'; echo ''; echo ''; ?> 生果<? echo $title[$page]; ?> http://www.fruitdaily.net Fruit Daily Rss 4){ //------Add on:2009-05-11-------------// $checkurl = get_headers("http://hk.apple.nextmedia.com/template/apple_sub/cache/$date/sec_art_$sec_id.js"); if ($checkurl[0] == 'HTTP/1.1 200 OK') { $requesturl = "http://hk.apple.nextmedia.com/template/apple_sub/cache/$date/sec_art_$sec_id.js"; }else{ $item =' ' . $title[$page] . ' 今天沒有刊出 ' .$title[$page] . '版 ' . $date . ' '; echo $item; } //-----------------------------------------// // $requesturl = "http://hk.apple.nextmedia.com/template/apple_sub/cache/$date/sec_art_$sec_id.js"; }else{ $requesturl = "http://hk.apple.nextmedia.com/template/apple/cache/$date/sec_art_$sec_id.js"; } if ($fp = fopen("$requesturl", "r")) { while(!feof($fp)) { $line = fgets($fp,256); if (eregi("^sub_title",$line)) { $line = ereg_replace("[:\", ]","",$line); $line = ereg_replace("sub_title","",$line); $title = eregi_replace("\\\"",'"',$line); } if (eregi("^art_id",$line)) { $line = ereg_replace("[:\",\\]","",$line); $article_id = ereg_replace("art_id","",$line); feedItems($title, $article_id); } } fclose($fp); } echo ''; function feedItems($title, $art_id) { global $date; $item = ' ' . $title . ' ' . feedContent(trim($art_id)) . ' ' . $date . $art_id . ' '; echo $item; } function feedContent($art_id) { global $date, $page; if ($page > 4) $hkline = file_get_contents("http://202.85.162.120/template/apple_sub/cache/$date/art_$art_id.xml"); else $hkline = file_get_contents("http://202.85.162.120/template/apple/cache/$date/art_$art_id.xml"); $reader = new XMLReader(); $reader->XML(utf8_encode($hkline)); $content = ""; while ($reader->read()) { if($reader->nodeType == XMLReader::ELEMENT) { if ($reader->getAttribute("name") == "content" || $reader->getAttribute("name") == "caption") { $reader->read(); $reader->read(); $text = utf8_decode($reader->value); if(strlen($text) > 1) $content .= $text . "
"; } else if ($reader->getAttribute("name") == "image_path") { $reader->read(); $reader->read(); $content .= 'value) . ">
"; } else if ($reader->getAttribute("name") == "sub_head") { $reader->read(); $reader->read(); $text = utf8_decode($reader->value); if(strlen($text) > 1) $content .= "
" . $text . "
"; } else if ($reader->getAttribute("name") == "intro") { $reader->read(); $reader->read(); $content .= '

' . utf8_decode($reader->value) . "

"; } /* else if ($reader->getAttribute("name") == "title") { $reader->read(); $reader->read(); $title = "

" . utf8_decode($reader->value) . "

"; }*/ } } $reader->close(); $item_date = substr($date,0,4)."年".substr($date,4,2)."月".substr($date,6,2)."日"; return ""; } ?>