fork(1) download
  1. <?php
  2.  
  3. $html = '<a href="uploads/tutorial1.pdf">tutorial1.pdf</a>
  4. <a href="uploads/tutorial2.pdf">tutorial1.pdf</a>
  5. <a href="uploads/tutorial3.pdf">tutorial1.pdf</a>';
  6.  
  7. $dom = new DOMDocument();
  8. $dom->loadHTML($html);
  9.  
  10. $tags = $dom->getElementsByTagName('a');
  11.  
  12. foreach ($tags as $tag) {
  13. echo $tag->nodeValue . ": " . $tag->getAttribute('href') . "\n";
  14. }
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
tutorial1.pdf: uploads/tutorial1.pdf
tutorial1.pdf: uploads/tutorial2.pdf
tutorial1.pdf: uploads/tutorial3.pdf