I want to fill an array with the links that I get from this foreach. How can I do that?
foreach($html->find('a') as $link) {
echo $link->href; //output: link1.html link2.html link3.html......
}
It's simple, Try this :-
$dataArray = array();
foreach($html->find('a') as $link) {
$dataArray[] = $link->href;
}
echo '<pre>';
print_r($dataArray);
echo '</pre>';