小编Yos*_*mon的帖子

用于从Shoutcast/Icecast流中提取艺术家和标题的PHP脚本

我找到了一个可以从Icecast或Shoutcast流中提取艺术家和标题名称的脚本.我希望脚本在歌曲改变时自动更新,此时它只在我执行它时工作.我是PHP的新手,所以任何帮助将不胜感激.谢谢!

define('CRLF', "\r\n");

class streaminfo{
public $valid = false;
public $useragent = 'Winamp 2.81';

protected $headers = array();
protected $metadata = array();

public function __construct($location){
    $errno = $errstr = '';
    $t = parse_url($location);
    $sock = fsockopen($t['host'], $t['port'], $errno, $errstr, 5);
    $path = isset($t['path'])?$t['path']:'/';
    if ($sock){
        $request = 'GET '.$path.' HTTP/1.0' . CRLF . 
            'Host: ' . $t['host'] . CRLF . 
            'Connection: Close' . CRLF . 
            'User-Agent: ' . $this->useragent . CRLF . 
            'Accept: */*' . CRLF . 
            'icy-metadata: 1'.CRLF.
            'icy-prebuffer: …
Run Code Online (Sandbox Code Playgroud)

php shoutcast audio-streaming icecast

7
推荐指数
1
解决办法
9181
查看次数

标签 统计

audio-streaming ×1

icecast ×1

php ×1

shoutcast ×1