I want to parse values from website category with paginated posts. Information that I need is inside posts. I tried to use Simple HTML DOM to do that. I got it, but I did not think that is correct. The script works slowly and with a large amount of data I get the error
Maximum execution timeout of 300 seconds
<?php
include('simple_html_dom.php');
$total_pages=600;
$i = 1;
while ($i <= $total_pages):
$html = file_get_html(''.$url.'/'.$from.'');
foreach($html->find('.itemReview h3 a') as $a) {
$post = file_get_html('http://www.website.com/'.$a->href.'');
$author_mail = $post->find('.sellerAreaSecond',0);
$author_mail = $post->plaintext;
$a_mail_array[] = $author_mail;
}
$fp = fopen('file.csv', 'w');
foreach( $a_mail_array as $ddd) {
fputcsv($fp, array($ddd));
}
fclose($fp);
$from++;
endwhile;
?>