I'm not really sure what you want to do, but I'll try to help you. It's a pretty easy solution, just follow these steps:
- Download PHP Siple HTML DOM Parser from Soureforge.
- Loop trough your URL array with a foreach loop.
- Find the content you want to scrape on each URL.
It's hard to help you because I don't know what content you want to get from each URL. But take a look at my example, it will scrape data from different questions on SO.
<?php
include 'simple_html_dom.php';
$list = array("http://stackoverflow.com/questions/31993435/how-i-can-use-simple-html-dom-php-to-use-all-the-links-inside-xml-and-get-the-ta",
"http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php?rq=1");
foreach($list as $url) {
$html = file_get_html($url);
foreach($html->find('#content') as $content) {
$row['url'] = $url;
$row['title'] = $content->find('h1', 0)->plaintext;
$row['vote'] = $content->find('span.vote-count-post', 0)->plaintext;
$result[] = $row;
}
}
?>
<pre>
<?php print_r($result); ?>
</pre>
OUTPUT:
Array
(
[0] => Array
(
[url] => http://stackoverflow.com/questions/31993435/how-i-can-use-simple-html-dom-php-to-use-all-the-links-inside-xml-and-get-the-ta
[title] => How i can use simple html dom php to use all the links inside xml and get the tags I want from them
[vote] => -2
)
[1] => Array
(
[url] => http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php?rq=1
[title] => How do you parse and process HTML/XML in PHP?
[vote] => 1186
)
)