if(!empty($articles)){
//Create the CSV file
$file = fopen("csv/".$phrase."_".$startPage."-".($startPage + $maxPages - 1).".csv","w"); //open file and truncate, create if it doesn't exist
foreach($articles as $item) {
fputcsv($file, explode('::',$item));
}
fclose($file);//close the file
echo "<style type=\"text/css\">h1, h2 {font-family: sans-serif; font-weight:lighter;}</style>
<h1>New file saved</h1>
<h2>URL Scraped: <a href=\"". $page ."\"><em>". $page ."</em></a></h2>
<h2>Time Taken: <strong>". ($timeFinish - $timeStart) ." seconds</strong></h2>
<h2>Total Pages scraped: <strong>". $totalPages ."</strong></h2>
<h2>Total contacts found: <strong>". count($articles) ."</strong></h2>";
}else{ // end if !empty $html
echo "No content found or bad URL";
}
先谢谢你的帮助:)。