<?php
    function getLinks($link)
    {
        /*** return array ***/
        $ret = array();
        /*** a new dom object ***/
        $dom = new domDocument;
        /*** get the HTML (suppress errors) ***/
        @$dom->loadHTML(file_get_contents($link));
        /*** remove silly white space ***/
        $dom->preserveWhiteSpace = false;
        /*** get the links from the HTML ***/
        $links = $dom->getElementsByTagName('a');
    
        /*** loop over the links ***/
        foreach ($links as $tag)
        {
            $ret[$tag->getAttribute('href')] = $tag->childNodes->item(0)->nodeValue;
        }
        return $ret;
    }
    
    /*** a link to search ***/
    $link = "http://codjng.blogspot.com/";
    /*** get the links ***/
    $urls = getLinks($link);
    /*** check for results ***/
    if(sizeof($urls) > 0)
    {
        foreach($urls as $key=>$value)
        {
            echo $key . ' - '. $value . '<br >';
        }
    }
    else
    {
        echo "No links found at $link";
    }
?>
 Title: 
Get Links With DOM
Description: 
<?php     function getLinks($link)     {         /*** return array ***/         $ret = array();         /*** a new dom object ***/       ...
                        ...
                        
Rating: 
                          4