title: Trying to get property of non-object?
body: <p>I've been getting an error message for the following piece of code (I'm trying to get the content inside the 'article' tags on a certain web page):</p>
  
  <pre><code>function getTextFromLink($url) {
      $html = new DOMDocument();
      $html-&gt;loadHTML($url);
      $text = $html-&gt;getElementsByTagName('article')-&gt;item(0)-&gt;textContent;
      return $text;
  }
  </code></pre>
  
  <p>It says that I'm trying to get the property of a non-object on the line with</p>
  
  <pre><code>$text = $html-&gt;getElementsbyTagName('article')-&gt;item(0)-&gt;textContent;
  </code></pre>
  
  <p>I'm fairly new to php and DOM; what am I missing here?</p>