php set_time_limit include parser php until 21 we have 24 notebooks on

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
set_time_limit(0);
include('parser.php');
$until = 21; //we have 24 notebooks on every page, 500 / 24 = 20
$hotline = new Curl;
$page = $hotline->get('http://hotline.ua/computer/noutbuki-netbuki/?sort=4');
preg_match('/<p class\=\"tech\-char\"/', $page, $pages);
if ($pages < $until) $until = $pages;
for ($i = 0; $i <= $until; $i++) {
if ($i != 0) {
$hotline = new Curl;
$page = $hotline->get('http://hotline.ua/computer/noutbuki-netbuki/?sort=4&p=' . $i);
}
preg_match_all('/<h3><a .+\}\);\">(.+)<\/a>/', $page, $name_matches);
preg_match_all('/\'tech\-char\'>(.+)<\/span>/', $page, $char_matches);
$string = '';
for ($a = 0; $a <= 24; $a++) {
$string .= 24 * $i + $a + 1 . '. '; //number of item
$string .= $name_matches[1][$a] . '<br/>' . $char_matches[1][$a] . '<br/>';
}
file_put_contents('popular_notebooks.html', $string, FILE_APPEND);
unset($hotline);
}