Created
October 29, 2013 12:24
-
-
Save Kagee/7213698 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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