I am trying to write code to read a list of names and then read all the
//this loop goes through our "pages" array and then for each page in the array...
foreach($pages as $page){
//...calls the function which pulll all of the HTML from the page into an array
$html = file_get_html($page);
//I think we need a multi-dimensional array, using name of ancestor as index for next array
// $ancestor = array()
// then FOR EACH element in the array of HTML, find the TD value
foreach($html->find('td') as $element){
//and put the value in our Ancestor array
$ancestor[] = $element->innertext.",";
}
}
//display the full Ancestor array to the page
print_r($ancestor);
//OPen the file called FILE.csv with 'w'=write permissions
$handle = fopen('export.csv', 'w');
fputcsv($handle, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5','Column 6','Column 7','Column 8','Column 9','Column 10','Column 11','Column 12','Column 13',));
foreach ($ancestor as $fields) {
fputcsv($handle, (array) $fields);
}
fclose($handle);
?>
?>