Use PHP to show Icecast2 statistics

前端 未结 3 1539
死守一世寂寞
死守一世寂寞 2020-12-28 12:08

I have some trouble viewing statistics (viewers, current song playing etc) with PHP and I can\'t find any information how to do this.

There is a couple of XLS files

3条回答
  •  甜味超标
    2020-12-28 12:32

    By using this code I've got it working:

    ]*class=\"streamdata\">(.*)<\/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);
       }
    }
    
    //sort our temp array into our ral array
    $radio_info['title'] = $temp_array[0];
    $radio_info['description'] = $temp_array[1];
    $radio_info['content_type'] = $temp_array[2];
    $radio_info['mount_start'] = $temp_array[3];
    $radio_info['bit_rate'] = $temp_array[4];
    $radio_info['listeners'] = $temp_array[5];
    $radio_info['most_listeners'] = $temp_array[6];
    $radio_info['genre'] = $temp_array[7];
    $radio_info['url'] = $temp_array[8];
    
    $x = explode(" - ",$temp_array[9]);
    $radio_info['now_playing']['artist'] = $x[0];
    $radio_info['now_playing']['track'] = $x[1];
    
    ?> 
    

提交回复
热议问题