title: How to detect if a page is an RSS or ATOM feed
body: <p>I'm currently building a new online Feed Reader in PHP. One of the features I'm working on is feed auto-discovery. If a user enters a website URL, the script will detect that its not a feed and look for the real feed URL by parsing the HTML for the proper <code>&lt;link&gt;</code> tag.</p>
  
  <p>The problem is, the way I'm currently detecting if the URL is a feed or a website only works part of the time, and I know it can't be the best solution. Right now I'm taking the CURL response and running it through <code>simplexml_load_string</code>, if it can't parse it I treat it as a website. Here is the code.</p>
  
  <pre><code>$xml = @simplexml_load_string( $site_found['content'] );
  
  if( !$xml ) // this is a website, not a feed
  {
      // handle website
  }
  else
  {
      // parse feed
  }
  </code></pre>
  
  <p>Obviously, this isn't ideal. Also, when it runs into an HTML website that it can parse, it thinks its a feed.</p>
  
  <p>Any suggestions on a good way of detecting the difference between a feed or non-feed in PHP?</p>