It's only kind of legal if your providing people with downloads to copyrighted music. First you'll have to search for the pages that are hosting the songs then strip out everything except the link to the media file and put it on your site. For an example of how to get the link...
Code:
$song = $_POST['song'];
$address = "http://site.com/default.asp?song_request=" . $song;
$location_holder = htmlspecialchars_decode(file_get_contents($address));
$mode = explode("Your Song is: ", $location_holder);
$mode = explode("Artist:", $mode[1]);
echo "Ctrl/Right Click Save as for Song: " .$mode[0];
Assuming the requested page has
Your Song is: <a href="http://site.com/sound/music.mp3">Song Name</a>
Artist:
Option 2 is if the linking is relative
Code:
$song = $_POST['song'];
$domain = "http://site.com";
$address = "$domain/default.asp?song_request=" . $song;
$location_holder = htmlspecialchars_decode(file_get_contents($address));
$mode = explode("Your Song is: ", $location_holder);
$mode = explode("Artist:", $mode[1]);
echo "Ctrl/Right Click Save as for Song: " .$mode[0];
You'll have to do some more exploding though to get the $domain in the link tag.
Bookmarks