【发布时间】:2018-08-15 01:55:53
【问题描述】:
基本上我想从外部 HTML 页面的脚本标签内部获取数据,
例子:
<script type="text/javascript">
var playerInstance = jwplayer("jwplayer");
playerInstance.setup({
id:'jwplayer',
width: "100%",
height: "100%",
aspectratio: "16:9",
fullscreen: "true",
primary: 'html5',
provider: 'http',
autostart: false,
sources: [{"type":"video/mp4","label":360,"file":"MY-VIDEO-LINK"},{"type":"video/mp4","label":480,"file":"MY-VIDEO-LINK"}],
});
我只想要黑标:>> 来源:[{"type":"video/mp4","label":360,"file":"MY-VIDEO-LINK"},{"type":"video/mp4","label" :480,"file":"MY-VIDEO-LINK"}]
我可以使用 PHP 访问该页面:$url = 'http://my-external-site.com/embed.php?url=blahblahblah';
我已经尝试过 Curl,没有运气,还有 DOM,差不多了:
include_once('simple_html_dom.php');
$html = file_get_html($url);
$elem = $html->find('sources', 0); //tried with 'sources' but probably is wrong
echo $elem;
非常感谢您的帮助,在此先感谢!
【问题讨论】: