【问题标题】:PHP get value with file_get_content()PHP 使用 file_get_content() 获取值
【发布时间】:2017-09-19 12:22:46
【问题描述】:

我想从此页面获取“文件”m3u8“view-source:http://www.freelivestream.tv/embedPlayer.php?file=cartoon

我正在尝试这段代码,但没有得到它所提供的全部价值,请提供任何帮助

    <?php

$url = "http://www.freelivestream.tv/embedPlayer.php?file=cartoon";
$contents = file_get_contents($url);

preg_match('@m3u8([^"]+)@',$contents,$filo);
$filo = urldecode($filo[0]);



echo $filo;


?> 

我想要这样:http://95.141.32.136:8081/edge/cartoon/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9OS8xOS8yMDE3IDEyOjE4OjEyIFBNJmhhc2hfdmFsdWU9aGI4bVZBZEdKY3E3ZVpFOWx3REdadz09JnZhbGlkbWludXRlcz01

但我的代码只给出:m3u8?wmsAuthSign=c2VydmVyX3RpbWU9OS8xOS8yMDE3IDEyOjE4OjEyIFBNJmhhc2hfdmFsdWU9aGI4bVZBZEdKY3E3ZVpFOWx3REdadz09JnZhbGlkbWludXRlcz01

谢谢

【问题讨论】:

  • 使用此代码然后分解并使用它 freelivestream.tv/embedPlayer.php?file=cartoon"; $contents = file_get_contents($url); preg_match('@file:(.*)@',$contents,$filo); $filo = urldecode($filo[0]);回声 $filo;?>

标签: php file-get-contents


【解决方案1】:

使用以下代码:

$url = "http://www.freelivestream.tv/embedPlayer.php?file=cartoon";
$contents = file_get_contents($url);

preg_match('/"(.*)m3u8(.*)"/',$contents,$filo);
$filo = urldecode($filo[0]);

echo $filo;

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-17
    • 2014-02-12
    • 1970-01-01
    • 2018-06-09
    • 1970-01-01
    • 2014-11-13
    相关资源
    最近更新 更多