php include libs curl pi_curl_exception php include libs curl pi_curl

 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
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include 'libs/curl/pi_curl_exception.php';
include 'libs/curl/pi_curl.php';
include 'libs/multicurl/pi_multicurl_exception.php';
include 'libs/multicurl/pi_multicurl.php';
$urls = file('urls.txt');
$cURL = new Pi_MultiCurl();
$cURL->setUrls($urls);
// Количество потоков
$cURL->setThreadsCount(5);
// Таймаут потока
$cURL->setThreadTimeout(3);
// Перерыв между потоками в мс
$cURL->setUsleepTime(300);
$result = $cURL->getUrls();
$fwBad = fopen('bad.txt', 'w+');
$fwGood = fopen('good.txt', 'w+');
foreach ($result as $thread) {
if(strpos($thread['contents'], 'Hacking attempt!') !== false) {
fwrite($fwGood, $thread['url'] . "\n");
} else {
fwrite($fwBad, $thread['url'] . "\n");
}
}
fclose($fwBad);
fclose($fwGood);