title: Use php DOMDocument() to get multipule span tag values and insert them into mysql db
body: <p>I need get multiple values from span tags using php, for example :</p>
  
  <pre><code>   &lt;div&gt;
      &lt;span class='name'&gt;name value&lt;/span&gt;
      &lt;span class='city'&gt;city name&lt;/span&gt;
      &lt;span class='street'&gt;street name&lt;/span&gt;
      &lt;span class='phone'&gt;+17240000000&lt;/span&gt;
      &lt;/div&gt;
    &lt;div&gt;
     &lt;span class='name'&gt;name value 2&lt;/span&gt;
     &lt;span class='city'&gt;city name 2&lt;/span&gt;
     &lt;span class='street'&gt;street name 2&lt;/span&gt;
     &lt;span class='phone'&gt;+17240000000 2&lt;/span&gt;
    &lt;/div&gt; 
  </code></pre>
  
  <p>I have to get span values using span class, i try this code to get the value, and it's working put for just 1 value such as "name" :</p>
  
  <pre><code>&lt;?
  $html = "&lt;div&gt;
           &lt;span class='name'&gt;name value&lt;/span&gt;
           &lt;span class='city'&gt;city name&lt;/span&gt;
           &lt;span class='street'&gt;street name&lt;/span&gt;
           &lt;span class='phone'&gt;+17240000000&lt;/span&gt;
           &lt;/div&gt;
           &lt;div&gt;
           &lt;span class='name'&gt;name value 2&lt;/span&gt;
           &lt;span class='city'&gt;city name 2&lt;/span&gt;
           &lt;span class='street'&gt;street name 2&lt;/span&gt;
           &lt;span class='phone'&gt;+17240000000 2&lt;/span&gt;
           &lt;/div&gt;";
  $dom = new DOMDocument();
  @$dom-&gt;loadHTML($html);
  $dom_xpath = new DOMXPath($dom);
  
  $entries = $dom_xpath-&gt;evaluate("//span[@class='name']");
  foreach ($entries as $entry) {
     echo  $entry-&gt;nodeValue."&lt;br /&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>Is there anyone to help me to retouch the code so i can get all values</p>
  
  <p>Thanks</p>