I have been always using preg_match to scrape URLs from HTML files but I wanted to extract only URLs that have .mp3 as their extension. I was told to try DOM and I have been trying to fix a code but it doesn't work. I get a blank page whatever I do. 
What am I doing wrong?
<?php
    $url = 'http://www.mp3olimp.net/miley-cyrus-when-i-look-at-you/';
    $html = @file_get_html($url);
    $dom = new DOMDocument();
    $doc->loadHTML($html);
    $xpath = new DOMXPath($doc); 
    $links = $xpath->query('//a[ends-with(@href, ".mp3")]/@href');
    echo $links;
?>
 
     
     
     
    