header("location:".$video[1]);
//curl ,按部就班的来
function http_curl($url)
//构建user_agent模拟 pc浏览器,下方的curl中使用
$UserAgent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36';
$curl = curl_init();
curl_setopt($curl, curlopt_URL, $url);
// 设置超时限制防止死循环
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
//设置可以302跳转
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($curl);
return $data;
- 海报