I have a function using this bit of code and I am trying to figure out what I am doing wrong. I want to find a web page's rss feed if it has one. As of right now, it's not returning any URL, it shows the type, but that's it. And the blog_url key does not get set in the array. Here is the code:
$results = array();
$doc = new DOMDocument();
@$doc->preserveWhiteSpace = FALSE;
$html = file_get_contents($url);
$doc->loadHTML("$html");
$links = $doc->getElementsByTagName('link');
foreach ($links as $tag) {
$type = $tag->getAttribute('type');
if (preg_match("/(rss+xml|atom+xml')/si", $type))
$href_text = $tag->nodeValue;
if(preg_match("/('feed|journal|blog')/si", $href_text))
$results['blog_url'] = $tag->getAttribute('href');
}