@ 2017-07-08T21:23:37Z <?php
$STATS_FILE = 'http://89.223.41.232:8000/status.xsl';
$DOCROOT = '/var/www/ideep1ru/playingnow/info'; // Корень сайта
$hostname = "89.223.41.232";
$username = "radio"; // Имя пользователя для БД
$password = "radio"; // И пароль
$dbName = "radio"; // Имя БД
$last1="http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=601f627a9fbb34ef24bc288cad4976e9&artist=";
$last2="&track=";
$spotify1="https://itunes.apple.com/search?term=";
$spotify2=" - ";
$spotify3="&limit=1";
$mysql_con = mysqli_connect($hostname,$username,$password,$dbName) OR die("Can't connect to database.");
mysqli_select_db($mysql_con, $dbName) or die(mysql_error());
mysqli_query($mysql_con,"SET NAMES 'cp1251';");
mysqli_query($mysql_con,"SET CHARACTER SET 'cp1251';");
mysqli_query($mysql_con,"SET SESSION collation_connection = 'cp1251_general_ci';");
$fp = fopen($STATS_FILE,'r');
if(!$fp) { die("Unable to connect to Icecast server."); }
$stats_file_contents = '';
while(!feof($fp)) { $stats_file_contents .= fread($fp,1024); }
fclose($fp);
$radio_info = array();
$radio_info['genre'] = '';
$radio_info['listeners'] = '';
$radio_info['now_playing'] = '';
$temp = array();
$search_for = "<td\s[^>]*class=\"streamdata\">(.*)<\/td>";
$search_td = array('<td class="streamdata">','</td>');
if(preg_match_all("/$search_for/siU",$stats_file_contents,$matches)) {
foreach($matches[0] as $match) {
$to_push = str_replace($search_td,'',$match);
$to_push = trim($to_push);
array_push($temp,$to_push);
}
}
$radio_info['listeners'] = $temp[4];
$radio_info['genre'] = $temp[6];
//$radio_info['now_playing'] = $temp[8];
//$radio_info['now_playing'] = $temp[8];
$radio_info['info']['now_playing'] = $temp[8];
$x = explode(" - ",$temp[8]);
$artist1 = $x[0];
$song1 = $x[1];
$artist1 = str_replace('&', 'and', $artist1);
$song1 = str_replace('&', 'and', $song1);
$ttt =" - ";
$title = $artist1.$ttt.$song1;
$img640_url= "https://i.deep1.ru/playingnow/logo_default.png";
$img300_url= "https://i.deep1.ru/playingnow/logo_default.png";
$img64_url= "https://i.deep1.ru/playingnow/logo_default.png";
echo $spotify_url=$spotify1.$artist1.$spotify2.$song1.$spotify3 ;
echo $spotify_url = str_replace(' ', '+', $spotify_url);
//$spotify_url = "https://itunes.apple.com/search?term=Kylie+Minogue";
$ch = curl_init($spotify_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$spotify = curl_exec($ch);
curl_close($ch);
$obj = json_decode($spotify);
//$total = $obj->resultCount->results;
//$img640_url = $obj->resultCount[0]->results[1]->artworkUrl100;
echo $img640_url;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for git.master , git.master_jit , rfc.property-hooks Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /in/vgjoA:18
Stack trace:
#0 {main}
thrown in /in/vgjoA on line 18
Process exited with code 255 . This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches Archived branches Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:dark mode live preview
51.01 ms | 401 KiB | 8 Q