Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 64 lines (45 sloc) 1.32 kB
<?php
require('../dbh.php');
$writer = new XMLWriter('1.0', 'utf-8');
$writer->openURI('php://output');
$writer->setIndent(false);
$writer->startDocument();
try {
$stmt = $dbh->prepare("SELECT * FROM `maps` WHERE `download` IS NOT NULL ORDER BY name ASC;");
if (!$stmt->execute()) {
throw new Exception("Internal error. Please try again later.");
}
$writer->startElement('maps');
while ($map = $stmt->fetchObject()) {
$writer->startElement('map');
$writer->startElement('id');
$writer->text($map->id);
$writer->endElement();
$writer->startElement('name');
$writer->text($map->name);
$writer->endElement();
$writer->startElement('author');
$writer->text($map->author);
$writer->endElement();
$writer->startElement('skill');
$writer->text($map->skill);
$writer->endElement();
$writer->startElement('download');
$writer->text($map->download);
$writer->endElement();
$writer->startElement('filename');
$writer->text($map->filename);
$writer->endElement();
$writer->endElement();
}
$writer->endElement();
} catch (Exception $e) {
$writer->startElement('error');
$writer->startCData();
$writer->text($e->getMessage());
$writer->endCData();
$writer->endElement();
}
header('Content-type: text/xml');
$writer->endDocument();
echo $writer->outputMemory();
Jump to Line
Something went wrong with that request. Please try again.