Skip to content

Instantly share code, notes, and snippets.

@AxlH
Created January 17, 2012 21:36
Show Gist options
  • Save AxlH/1629080 to your computer and use it in GitHub Desktop.
Save AxlH/1629080 to your computer and use it in GitHub Desktop.
<?php
/**
* @author Axl Hoogelander
* @copyright 2012
*/
class RSS_Feed{
private $url;
public function __construct($url){
$this->url = $url;
}
public function xml()
{
$rss = file_get_contents($this->url);
if(preg_match('/<rss version="2.0">/', $rss)){
return simplexml_load_string($rss);
}else{
echo 'this isnt a rss feed!';
exit();
}return simplexml_load_file($this->url);
}
public function title(){
return self::xml()->channel->title;
}
public function content(){
return self::xml()->channel->item;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment