Skip to content

Instantly share code, notes, and snippets.

@beweinreich
Last active June 21, 2017 16:01
Show Gist options
  • Save beweinreich/3129613 to your computer and use it in GitHub Desktop.
Save beweinreich/3129613 to your computer and use it in GitHub Desktop.
<?
$request_url = "SOME-URL-THAT-HAS-XML";
$xml = simplexml_load_file($request_url) or die("feed not loading");
foreach($xml->entry as $entry) {
$id = $entry->id;
$author = $entry->author;
$title = $entry->title;
$content = $entry->content;
// if there are a bunch of tags that are the same (for example 'link'), and we want the audio/mpeg one only
foreach($entry->link as $d) {
$entry[$d['type']] = (string) $d["href"];
}
$audio = $entry["audio/mpeg"];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment