forked from bupt1987/html-parser
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
Latest commit
25 lines (21 loc) · 618 Bytes
/
Copy pathtest.php
File metadata and controls
25 lines (21 loc) · 618 Bytes
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
<?php
require'vendor/autoload.php';
$url = 'http://www.sina.com.cn/';
$sHtml = file_get_contents($url);
for($i = 0; $i < 10000; $i ++) {
test($sHtml);
if($i % 100 == 0) {
echo$i . '';
echoround(memory_get_usage() / 1024 / 1024, 3) . 'M, ';
echoround(memory_get_peak_usage() / 1024 / 1024, 3) . 'M' . "\n";
}
}
echoround(memory_get_usage() / 1024 / 1024, 3) . 'M, ';
echoround(memory_get_peak_usage() / 1024 / 1024, 3) . 'M' . "\n";
functiontest($sHtml) {
$oDom = new \HtmlParser\ParserDom($sHtml);
$oDom->find('ul.uni-blk-list02', 0);
$oDom->find('a');
$oDom->find('ul');
$oDom->find('p');
}