A slightly smaller function that captures the first available channel, be it rss or atom (most blogs have two options - this captures the first preference).
public function getFeedUrl($url){ if(@file_get_contents($url)){ preg_match_all('/<link\srel\=\"alternate\"\stype\=\"application\/(?:rss|atom)\+xml\"\stitle\=\".*href\=\"(.*)\"\s\/\>/', file_get_contents($url), $matches); return $matches[1][0]; } return false; }
source share