【发布时间】:2017-04-21 12:42:38
【问题描述】:
我创建了一个 php 代码,通过使用 file_get_contents 从该页面的标签“hlsUrl”中获取第一个 m3u8 链接,但它不起作用,请提供任何帮助
我的代码是
> <?php
>
> $link =
> "https://stream.live/-/streams/users/kawkaw?includeTrending=true" ;
>
> $actualLink = file_get_contents($link);
> echo $actualLink->find("hlsUrl");
>
> ?>
【问题讨论】:
-
$actualLink是字符串,字符串没有函数find。 -
file_get_contents会返回字符串,所以没有find方法。先解析一下 -
另外,为了将来参考,说 “但它不起作用” 对任何人都没有帮助。向我们显示错误消息。
-
不工作我的意思是在浏览器显示页面上不会像网站不工作一样加载:)
标签: php file-get-contents