title: PHP, XML How to get attributes?
body: <p>I am trying to return the values of the <code>SECTION</code> attribute of the <code>INTRO</code> tags from the following xml:</p>
  
  <p>Sample of myxml.xml:</p>
  
  <pre><code>&lt;INTRO SECTION="ONE"&gt;
    &lt;TEXT&gt;Hello&lt;/TEXT&gt;
  &lt;/INTRO&gt;
  &lt;INTRO SECTION="TWO"&gt;
    &lt;TEXT&gt;Goodbye&lt;/TEXT&gt;
  &lt;/INTRO&gt;
  </code></pre>
  
  <p>My PHP:</p>
  
  <pre><code>$doc = new DOMDocument();
  $doc-&gt;load('myxml.xml');
  $intros = $doc-&gt;getElementsByTagName("INTRO");
  
  foreach( $intros as $intro ) {
  echo $intro -&gt;get_attribute('SECTION');
  }
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <blockquote>
    <p>Call to undefined method DOMElement::get_attribute()</p>
  </blockquote>
  
  <p>Does anyone know what I am doing wrong? Kind regards to any responders.</p>