suppose that I have text database include is ;
http://ift.tt/1Ass03d
http://ift.tt/1r4nShf
http://ift.tt/1Ass2rC
I would like to convert to my text database to sitemap.xml.
$fp = fopen('./database.txt', 'r');
$xml = new XMLWriter;
$xml->openURI('./sitemap.xml');
$xml->setIndent(true);
$xml->startElement('urlset');
while ($line = fgetcsv($fp)) {
if (count($line) < 4) continue;
$xml->startElement('url');
$xml->writeElement('loc', $line[0]);
$xml->writeElement('changefreq', $line[1]);
$xml->writeElement('priority', $line[2]);
echo $xliff->getDocument();
$xml->endElement();
}
$xml->endElement();
I tried this code , I couldn't add this part...
xml version="1.0" encoding="UTF-8"
http://ift.tt/1r4nShl'xsi:schemaLocation='ht.tp://w.w.w.sitemaps.org/schemas/sitemap/0.9 h.ttp://w.w.w.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
I am waiting your help. Regards.
No comments:
Post a Comment