This should get you going if you need to use PHP. But maybe you want to work in JS in the client? The code is commented. Obviously you need to get to BenM's link.
z1.htm:
<html><head></head><body>
<a href="something" name="something">some value</a>
<a href="something2" name="something2">some value2</a>
<a href="something3" name="something3">some value3</a>
</body></html>
z1.php:
<?php
$sfile = file_get_contents('z1.htm'); // loads file to string
$html = new DOMDocument; // is object class DOMDocument
$html->loadHTML($sfile); // loads html
$nodelist = $html->getElementsByTagName('a'); // nodes
foreach ($nodelist as $node) {
echo $node->nodeValue, "<br />\n"; }
?>