반응형

<?
 $xml = "";
 $xml .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
 $xml .= "<rss version=\"2.0\">\n";
 $xml .= "<channel>\n";
 $xml .= "<title>홈페이지 명</title>\n";
 $xml .= "<link>홈페이지 url</link>\n";
 $xml .= "<description>검색키워드</description>\n";
 $xml .= "<language>ko</language>\n";
 $xml .= "<pubDate>".date('D, d M Y H:i:s O')."</pubDate>\n";
 $xml .= "<item>\n";
 $xml .= "<title>컨텐츠 1</title>\n";
 $xml .= "<link>컨텐츠 1 url</link>\n";
 $xml .= "<description>\n";
 $xml .= "컨텐츠 설명";
 $xml .= "&lt;a href=&quot;http://url/&quot; target=&quot;_black&quot;&gt;&lt;img src=&quot;http://img url&quot; border=&quot;0&quot;&gt;&lt;/a&gt;\n";
 $xml .= "</description>\n";
 $xml .= "<category>컨텐츠 1 태그(키워드)</category>\n";
 $xml .= "<category>컨텐츠 2 태그(키워드)</category>\n";
 $xml .= "<category>컨텐츠 3 태그(키워드)</category>\n";
 $xml .= "<pubDate>".date('D, d M Y H:i:s O')."</pubDate>\n";
 $xml .= "</item>\n";
 $xml .= "<item>\n";
 $xml .= "<title>컨텐츠 2</title>\n";
 $xml .= "<link>컨텐츠 2 url</link>\n";
 $xml .= "<description>\n";
 $xml .= "컨텐츠 설명";
 $xml .= "</description>\n";
 $xml .= "<category>컨텐츠 1 태그(키워드)</category>\n";
 $xml .= "<category>컨텐츠 2 태그(키워드)</category>\n";
 $xml .= "<category>컨텐츠 3 태그(키워드)</category>\n";
 $xml .= "<pubDate>".date('D, d M Y H:i:s O')."</pubDate>\n";
 $xml .= "</item>\n";
 $xml .= "</channel>\n";
 $xml .= "</rss>\n";

 $filename = "/var/www/html/xml/rss.xml";
 
 $HTTP_RAW_POST_DATA = $xml;
 
 $fp = fopen($filename,"w+");
 fwrite ($fp, "$HTTP_RAW_POST_DATA");
 fclose($fp);
}
?>

반응형