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.