-
Notifications
You must be signed in to change notification settings - Fork 49
/
example.php
79 lines (66 loc) · 2.2 KB
/
example.php
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
# Setting time and memory limits
ini_set('max_execution_time',0);
ini_set('memory_limit', '128M');
define('AC_DIR', dirname(__FILE__));
# Including classes
require_once( AC_DIR . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'RollingCurl.class.php');
require_once( AC_DIR . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'AngryCurl.class.php');
# Initializing AngryCurl instance with callback function named 'callback_function'
$AC = new AngryCurl('callback_function');
# Initializing so called 'web-console mode' with direct cosnole-like output
$AC->init_console();
# Importing proxy and useragent lists, setting regexp, proxy type and target url for proxy check
# You may import proxy from an array as simple as $AC->load_proxy_list($proxy array);
$AC->load_proxy_list(
AC_DIR . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR . 'proxy_list.txt',
# optional: number of threads
200,
# optional: proxy type
'http',
# optional: target url to check
'http://google.com',
# optional: target regexp to check
'title>G[o]{2}gle'
);
$AC->load_useragent_list( AC_DIR . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR . 'useragent_list.txt');
# Basic request usage (for extended - see demo folder)
$AC->get('http://ya.ru');
$AC->get('http://ya.ru');
$AC->get('http://ya.ru');
# Starting with number of threads = 200
$AC->execute(200);
# You may pring debug information, if console_mode is NOT on ( $AC->init_console(); )
//AngryCurl::print_debug();
# Destroying
unset($AC);
# Callback function example
function callback_function($response, $info, $request)
{
if($info['http_code']!==200)
{
AngryCurl::add_debug_msg(
"->\t" .
$request->options[CURLOPT_PROXY] .
"\tFAILED\t" .
$info['http_code'] .
"\t" .
$info['total_time'] .
"\t" .
$info['url']
);
}else
{
AngryCurl::add_debug_msg(
"->\t" .
$request->options[CURLOPT_PROXY] .
"\tOK\t" .
$info['http_code'] .
"\t" .
$info['total_time'] .
"\t" .
$info['url']
);
}
return;
}