Sunday, March 14, 2010

php - create xml file


$outDom = new DOMDocument('1.0','UTF-8');
$outDom->formatOutput = true;
$outRoot = $outDom->appendChild($outDom->createElement('blogs'));

$blogsLinks = getBlogLinks();

//insert in db
$result = mysql_query("insert into updates(Date) values('".date("Y-m-d h:i:s")."')");
$updateIDs = mysql_query("select max(UpdateID) from updates");
while ($row = mysql_fetch_array($updateIDs, MYSQL_NUM))
{
$updateID = $row[0];
}


foreach($blogsLinks as $link)
{
$outRoot->appendChild(parseXmlDocument($link, $outDom, $outRoot, $updateID));
}
$outDom->save('result.xml');

No comments:

Post a Comment