fork download
  1. <?php
  2.  
  3. $html = '<span id="Number">12345678993</span>
  4.  
  5. <span id="holderName">RAFAELA VERCOSA MARIANO</span>
  6.  
  7. <span id="expirationDate">11/2019</span>';
  8.  
  9. $DOM = new DOMDocument;
  10. $DOM->loadHTML($html);
  11. $items = $DOM->getElementsByTagName('span');
  12.  
  13. // Imprimindo os valores
  14. for ($i = 0; $i < $items->length; $i++)
  15. echo $items->item($i)->nodeValue . PHP_EOL;
  16.  
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
12345678993
RAFAELA VERCOSA MARIANO
11/2019