Heres a quick script to grab all the links from a website (theregister.co.uk in this case!)
Code:
<?
# retrieve the contents of the webpage in your browser
$webpagehtml=file_get_contents("http://www.theregister.co.uk");
# Then you can parse the html into a dom object
$dom=new DOMDocument();
$dom->loadHTML($webpagehtml);
$xpath=new DOMXPath($dom);
$items = $xpath->query("//a");
$links=array();
for ($i = 0; $i < $items->length; $i++ ) {
$item = $items->item($i);
$title=$item->textContent;
$href=$item->getAttribute('href');
if($href && $title){
echo "$href = $title<br/>";
}
}
Any requests?