$track_name, 'output' => 'json', 'nb_items' => 1 ); $search_uri = $api_endpoint .'?' .http_build_query($search_parameters); $track = json_decode(file_get_contents($search_uri)); return empty($track->data) ?: $track->data[0]->album->cover; } function getStreamStatus($server, $mount){ $header = get_headers($server.$mount); if($header[0] == 'HTTP/1.0 200 OK'){ return 'On Air'; } else{ return 'Off Air'; } } function getStreamInfo($server, $mount){ $output = file_get_contents($server.'/status.xsl?mount='.$mount); $temp_array = array(); $search_for = "]*class=\"streamstats\">(.*)<\/td>"; $search_td = array('',''); if(preg_match_all("/$search_for/siU",$output,$matches)) { foreach($matches[0] as $match) { $to_push = str_replace($search_td,'',$match); $to_push = trim($to_push); array_push($temp_array,$to_push); } } $stream_info['currently_playing'] = $temp_array[5]; $x = explode(" - ", $temp_array[5]); $stream_info['artiste'] = $x[0]; $stream_info['titre'] = $x[1]; // print_r($stream_info); return $stream_info; } $etat = getStreamStatus($server, $mount); $stream_info = getStreamInfo($server, $mount); $interpTitre = $stream_info['currently_playing']; $titre = $stream_info['titre']; $interp = $stream_info['artiste']; $lienInfo="https://www.deezer.com/search/".$interpTitre; $cover = getCoverOf($interp." ".$titre); // Si zcover non référencée if ($cover=="1") { $cover = "img/rdb.png"; } // Si aucune info if ($interp=="" and $titre=="") { $interp = "Aucune information"; $titre = "disponible"; } ?>