Skip to content

Instantly share code, notes, and snippets.

@Kagee
Created October 29, 2013 12:24
Show Gist options
  • Save Kagee/7213698 to your computer and use it in GitHub Desktop.
Save Kagee/7213698 to your computer and use it in GitHub Desktop.
function processDoc($docUrl) {
$doc = new DOMDocument();
$xpath = new DOMXpath($doc);
// Fortell PHP at atom:-tagger finnes (ikke reell DTD-URL):
$xpath->registerNamespace('atom', 'http://www.w3.org/2005/Atom/');
$config = array(
'input-xml' => true,
'output-xml' => true);
$tidy = new tidy;
$tidyXML = $tidy->repairFile($docUrl, $config, "utf8");
echo $tidyXML;
if (!$doc->loadXML($tidyXML)) {
$title = 'Operasjon feilet';
$body = '<p>Klarte ikke å laste RSS-fil</p>';
}
else { // Finn alle elementer:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment