<? header("Content-Type: application/xml; charset=ISO-8859-1"); ?>
<rss version="2.0">
<channel>
<title>Petrowatch TOP STORIES</title>
<description>Market Intelligence form india's oil and gas industry</description>
<link>http://www.petrowatch.com/</link>
<lastBuildDate><? print(date("D, d M Y H:i:s T"));?></lastBuildDate>
<generator>petrowatch.com</generator>
<copyright>Copyright 2011, Petrowatch</copyright>
<language>en</language>
<?

function htmltoXMLData($stripped_data){
	//$stripped_data = htmlentities($stripped_data);
	$stripped_data = htmlspecialchars($stripped_data);
	$stripped_data = preg_replace('@[\x00-\x08\x0B\x0C\x0E-\x1F]@', ' ', $stripped_data);
	
	return $stripped_data;
}

include("../constants.php");
include(MYSITE_SERVERURL."/database.php");
include(MYSITE_SERVERURL."/session.php");
include(MYSITE_SERVERURL."/functions.php");
include(MYSITE_SERVERURL."/arrays.php");

$resultStory1 = getAllRows("storyId, title, synopsis, timestmp", "tbl_stories", "WHERE sectionId = '1' AND status = '1' ORDER BY issueDate DESC LIMIT 50");
while($resStr1 = mysql_fetch_array($resultStory1)){
	$storyId1 = $resStr1["storyId"];
	$title1 = htmltoXMLData($resStr1["title"]);
	$story1 = htmltoXMLData($resStr1["synopsis"]);
	$timestmp = $resStr1["timestmp"];
	$url="http://www.petrowatch.com/synopsis.php?artId=$storyId1&w=1";
	$url = htmlspecialchars($url);	
?>
<item>
      <title><?="$title1";?></title>
      <link><?=$url?></link>
      <description><?=$story1?></description>
      <pubDate><? print(showdate($timestmp, "D, d M Y H:i:s T"));?></pubDate>
   </item>
<? } ?>  
   </channel>
</rss>  