<?
require 'simple_html_dom.php';
$unique = array();
$uri = 'https://www.beatport.com/artist/avengers/203716/tracks';
$bp_html = file_get_html($uri);
$bp_tracks_codes = $bp_html->find('li[class=track]');
foreach ($bp_tracks_codes as $bp_track_code){
$bp_t_code_pos1 = strpos($bp_track_code, 'data-ec-name="');
$bp_t_code_pos2 = strpos($bp_track_code, '" data-ec-creative=');
$bp_t_code_str = substr($bp_track_code,$bp_t_code_pos1,$bp_t_code_pos2-$bp_t_code_pos1);
$bp_t_code_find = array('data-ec-name=', '"', ' - track - ');
$bp_t_code_replace = array('', '', '-');
$bp_track_code = str_replace($bp_t_code_find, $bp_t_code_replace, $bp_t_code_str);
list ($track_code, $track_title) = explode("-", $bp_track_code);
if (!in_array($track_code, $unique)) {
$audio_link = str_replace(' ', '', 'http://geo-samples.beatport.com/lofi/' . $track_code . '.LOFI.mp3');
echo '<b>' .$track_title . '</b><br><audio preload="auto" src="' .$audio_link. '" controls="controls"></audio><hr>';
array_push($unique, $track_code);
}
}
?>