Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2013 00:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hjst/6693256 to your computer and use it in GitHub Desktop.
Pulls in an overstuffed RSS feed and removes any content:encoded nodes (which are usually superfluous).
$ch = curl_init("FEED URL GOES HERE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_USERAGENT, "Henry's very friendly feed fetcher v1.1");
$rss_string = curl_exec($ch);
$dom = new DOMDocument();
$contents = $dom->getElementsByTagNameNS('', 'encoded');
while ($contents->length > 0) {
header('Content-Type: text/xml');
print( $dom->saveXML() );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment