Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WordPress插件,用于抓取BBCs最受欢迎的部分_Wordpress_Simple Html Dom_Domparser - Fatal编程技术网

WordPress插件,用于抓取BBCs最受欢迎的部分

WordPress插件,用于抓取BBCs最受欢迎的部分,wordpress,simple-html-dom,domparser,Wordpress,Simple Html Dom,Domparser,我正试图从bbc.co.uk/news/网站上把最受欢迎的部分刮到WordPress插件中。我目前有以下代码: <?php /* Plugin Name: BBC Scrape Description: Reprints the BBCs Most popular stories Author: The Health Check Team Version: 0.1-alpha */ include('simple_html_dom.php');

我正试图从bbc.co.uk/news/网站上把最受欢迎的部分刮到WordPress插件中。我目前有以下代码:

<?php 
/*
    Plugin Name: BBC Scrape
    Description: Reprints the BBCs Most popular stories 
Author: The Health Check Team
    Version: 0.1-alpha
 */

include('simple_html_dom.php');        
$articles = array();  
getArticles('http://www.bbc.co.uk/news/');      
function getArticles($page) {  
    global $articles;  
  <br>
    $html = new simple_html_dom();  
    $html->load_file($page);  

$items = $html->find('div[class=livestats livestats-tabbed tabbed most-popular]');    

foreach($items as $post) {  
    # remember comments count as nodes  
    $articles[] = array($post->children(3)->outertext,  
                        $post->children(4)->first_child()->outertext,  
            $post->children(5)->first_child()->outertext);  
} 

}
?>

我以前使用过像
wp\u remote\u get
这样的功能,但是这只是获得了整个站点。我无法使用DOM解析将其过滤到最流行的部分。 我在这段代码中遇到的错误是未编辑的
simple\u html\u dom.php
文档中的函数
find()
错误


我基本上不明白我怎么能自己获得bbc.co.uk/news栏目中最受欢迎的栏目

我猜BBC不会喜欢你们试图归档的东西。我明白,这只是我试图做的一种学习技巧。因为它将帮助我如何使用DOM解析和simple_html_DOM.php文件。我不是为了我的利益而使用它。