Published on 2007-08-12 08:57:28

Justin Laing have written a good tutorial on scraping links from any website using PHP. Very useful if you look forward making a link analyzer tool. The tutorial uses CURL and DOMXPath to retrieve data and extract links. However you can also use it to retrieve more informations about the same link such the "alt" and "target" attributes.

$url = $href->getAttribute('href');
$alt = $href->getAttribute('alt');
$target = $href->getAttribute('target');


Then you can change your tables accordingly to store these new informations.


Related Entries

Member of the PHP Magazine Network, Copyright (C) 2005-2009 phpmagazine.net All Rights Reserved