php | 게시글 php형식 -> rss(xml)형식으로 변환 하기
페이지 정보
작성자 100K5 작성일12-04-01 09:30 조회75,956회 댓글0건관련링크
본문
<?
include_once("./_common.php");
// 특수문자 변환
function specialchars_replace($str, $len=0) {
if ($len) {
$str = substr($str, 0, $len);
}
$str = preg_replace("/&/", "&", $str);
$str = preg_replace("/</", "<", $str);
$str = preg_replace("/>/", ">", $str);
return $str;
}
Header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"; [^]
echo "<channel>\n";
echo "<title>".specialchars_replace("$title")."</title>\n";
echo "<link>".specialchars_replace("board.php?bo_table=$bo_table")."</link>\n";
echo "<description>테스트 버전 0.2 (2004-04-26)</description>\n";
echo "<language>ko</language>\n";
$sql = " select * from board_table";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$file = "";
if (strstr($row[wr_option], 'html'))
$html = 1;
else
$html = 0;
echo "<item>\n";
echo "<title>".specialchars_replace($row[wr_subject])."</title>\n";
echo "<link>".specialchars_replace("$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]")."</link>\n";
echo "<description><![CDATA[".$file . conv_content($row[wr_content], $html)."]]></description>\n";
echo "<dc:creator>".specialchars_replace($row[wr_name])."</dc:creator>\n";
$date = $row[wr_datetime];
// rss 리더 스킨으로 호출하면 날짜가 제대로 표시되지 않음
//$date = substr($date,0,10) . "T" . substr($date,11,8) . "+09:00";
$date = date('r', strtotime($date));
echo "<dc:date>$date</dc:date>\n";
echo "</item>\n";
}
echo "</channel>\n";
echo "</rss>\n";
?>
include_once("./_common.php");
// 특수문자 변환
function specialchars_replace($str, $len=0) {
if ($len) {
$str = substr($str, 0, $len);
}
$str = preg_replace("/&/", "&", $str);
$str = preg_replace("/</", "<", $str);
$str = preg_replace("/>/", ">", $str);
return $str;
}
Header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n"; [^]
echo "<channel>\n";
echo "<title>".specialchars_replace("$title")."</title>\n";
echo "<link>".specialchars_replace("board.php?bo_table=$bo_table")."</link>\n";
echo "<description>테스트 버전 0.2 (2004-04-26)</description>\n";
echo "<language>ko</language>\n";
$sql = " select * from board_table";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$file = "";
if (strstr($row[wr_option], 'html'))
$html = 1;
else
$html = 0;
echo "<item>\n";
echo "<title>".specialchars_replace($row[wr_subject])."</title>\n";
echo "<link>".specialchars_replace("$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]")."</link>\n";
echo "<description><![CDATA[".$file . conv_content($row[wr_content], $html)."]]></description>\n";
echo "<dc:creator>".specialchars_replace($row[wr_name])."</dc:creator>\n";
$date = $row[wr_datetime];
// rss 리더 스킨으로 호출하면 날짜가 제대로 표시되지 않음
//$date = substr($date,0,10) . "T" . substr($date,11,8) . "+09:00";
$date = date('r', strtotime($date));
echo "<dc:date>$date</dc:date>\n";
echo "</item>\n";
}
echo "</channel>\n";
echo "</rss>\n";
?>
댓글목록
등록된 댓글이 없습니다.