1 回答
TA贡献1827条经验 获得超9个赞
两个链接都不起作用,但假设 html 看起来像这样a.html:
<video width="320" height="240" src="https://fvs.io/redirector?token=aVVHRmZNVzZVdldkRXJUZXdrSWRQV2RxQ2RSSjdFNGphTVBVQTVBRTR4TlpFYXdMbzlXaktueW9ETW5ma2QvYjlOZG42Mzg2eGNWSDNjT3BHUC8wMmxyUTcrZyt4ZzRwV0s4UWVLcWQzZExzdUVBN1dIbUVmSVhrbnlIWENwWHhFR09LRVBHcXpLUmg4NFlCaW10SzBGeVU2VXVNL3FvMjpUMXRDKytHYng5S1RTTU1laG0vbFZRPT0"></video>
尝试这个:
<?php
$data = file_get_contents('a.html');
preg_match('/<video.*?src="(.*?)"/', $data, $matches);
var_dump($matches[1]);
输出:
string(279) "https://fvs.io/redirector?token=aVVHRmZNVzZVdldkRXJUZXdrSWRQV2RxQ2RSSjdFNGphTVBVQTVBRTR4TlpFYXdMbzlXaktueW9ETW5ma2QvYjlOZG42Mzg2eGNWSDNjT3BHUC8wMmxyUTcrZyt4ZzRwV0s4UWVLcWQzZExzdUVBN1dIbUVmSVhrbnlIWENwWHhFR09LRVBHcXpLUmg4NFlCaW10SzBGeVU2VXVNL3FvMjpUMXRDKytHYng5S1RTTU1laG0vbFZRPT0"
如果它不起作用,请转储您的 $data 并确保视频标签在那里。有时这是稍后通过 ajax 加载的,因此它甚至在初始响应中不可用。
- 1 回答
- 0 关注
- 151 浏览
添加回答
举报