为什么代码无法正常工作(解析器phpQuery)?

时间:2018-10-01 21:36:48

标签: php phpquery

我不明白为什么它不起作用。脚本无法解析 scr =“”

中的链接
<html>
<head>
<title>test</title>
</head>
<body>
<?php
header('Content-type: text/html; charset=utf-8');
require_once 'phpQuery.php';

function parser($url, $start, $end){
 if($start < $end){
  $file = file_get_contents($url);
  $doc = phpQuery::newDocument($file);
  foreach($doc->find('.video-js') as $article){
 $article = pq($article);

 $scr = $article->find('video')->attr('src');

 echo "<video src='$scr'></video>";
 echo '<hr>';
  }

  $next = $doc->find('.pages-nav .current')->next()->attr('src');
  if( !empty($next) ){
 $start++;
 parser($next, $start, $end);
  }
 }
}

$url = 'http://video.meta.ua/9879129.video';
$start = 0;
$end = 1;
parser($url, $start, $end);
?>
</body>
</html>

请帮助,有什么问题吗? 我在做什么错?..

0 个答案:

没有答案