print_r statement doesn't seem to work
<p>I am building a web crawler. It finds all the links on a page and their titles and meta descriptions etc. It does that fine. Then i wrote an array which gives all the starting urls for the links I want. So if it crawls a link and its url begins with any value in the array which gives the starting urls, insert into $news_stories.</p>

<p>The only problem is it doesn't seem to be inserting into them. The page returns blank and now it says that the array_intersect statement wants an array and that I havent specfied an array which I have.</p>

<p>In summary, I am struggling to understand where my code doesn't work and why the wanted urls aren't being inserted.</p>

<pre><code>$bbc_values = array(
    'http://www.bbc.co.uk/news/health-', 
    'http://www.bbc.co.uk/news/politics-', 
    'http://www.bbc.co.uk/news/uk-', 
    'http://www.bbc.co.uk/news/technology-',  
    'http://www.bbc.co.uk/news/england-', 
    'http://www.bbc.co.uk/news/northern_ireland-', 
    'http://www.bbc.co.uk/news/scotland-', 
    'http://www.bbc.co.uk/news/wales-', 
    'http://www.bbc.co.uk/news/business-', 
    'http://www.bbc.co.uk/news/education-', 
    'http://www.bbc.co.uk/news/science_and_enviroment-',         
    'http://www.bbc.co.uk/news/entertainment_and_arts-', 
    'http://edition.cnn.com/'
);

// BBC Algorithm
foreach ($links as $link) {
    $output = array(
        "title"       =&gt; Titles($link), //dont know what Titles is, variable or string?
        "description" =&gt; getMetas($link),
        "keywords" =&gt; getKeywords($link), 
        "link"        =&gt; $link                 
    );

    if (empty($output["description"])) {
        $output["description"] = getWord($link);
    }
}

$new_stories = array();

foreach ($output as $new_array) {
    if (array_intersect($output['link'], $bbc_values) == true) {
        $news_stories[] = $new_array;
    }

    print_r($news_stories);
}
</code></pre>
