Created
December 13, 2010 15:03
-
-
Save mach3/739067 to your computer and use it in GitHub Desktop.
Get the feed informations using xpath.
This file contains 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
<?php | |
$dom = @DOMDocument::loadHTMLFile( $url ); | |
$xpath = new DOMXpath( $dom ); | |
$query = "//link[ @rel='alternate' and ( @type='application/x.atom+xml' or " | |
. "@type='application/atom+xml' or @type='application/xml' or @type='text/xml' or " | |
. "@type='application/rss+xml' or @type='application/rdf+xml' ) ]"; | |
$elements = $xpath->query( $query ); | |
foreach( $elements as $element ){ | |
echo "{$element->getAttribute('href')} ({$element->getAttribute('type')})"; | |
echo "<br />"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment