Пример #1
0
$AC->request('http://ya.ru');
/* NOTE: IF USING get() - "on the fly" proxy server changing WILL apply
 * 
 * You may use shorcut get(URL, HEADERS, CURL OPTIONS) to create add new GET requests
 *  HEADERS       may be any HTTP headers
 *  CURL OPTIONS  may be any of supported by CURL
 */
$AC->get('http://ya.ru');
/* NOTE: IF USING post() - "on the fly" proxy server changing WILL apply
 *
 * You may use shorcut post(URL, POST_DATA, HEADERS, CURL OPTIONS) to create add new GET requests
 *  POST_DATA     may be an array of POST-params
 *  HEADERS       may be any HTTP headers
 *  CURL OPTIONS  may be any of supported by CURL
 */
$AC->post('http://ya.ru');
/* WARNING: IF USING AngryCurlRequest - no "on the fly" proxy server changing will apply
 *
 * You may use AngryCurlRequest(URL, METHOD, POST_DATA, HEADERS, CURL OPTIONS) to create add new requests
 *  METHOD        may be GET or POST
 *  POST_DATA     may be an array of POST-params
 *  HEADERS       may be any HTTP headers
 *  CURL OPTIONS  may be any of supported by CURL
 *
 * Properties are public, they may be passed to constructer on changed after as in example below
 */
$request = new AngryCurlRequest('http://ya.ru');
$request->options = array(CURLOPT_HEADER => true, CURLOPT_NOBODY => true);
$AC->add($request);
# Starting with number of threads = 200
$AC->execute(200);
Пример #2
0
    set_leftside_style($col, $row);
    $row += 1;
}
/* Populate commision table */
$row = 2;
foreach ($amount_array as $amount) {
    $col = 1;
    foreach ($time_array as $time) {
        /* Multiple thread implementation */
        $options = array();
        $options['fz'] = $fz;
        $options['program'] = $program;
        $options['avans'] = $avans;
        $options['money'] = $amount;
        $options['dd'] = $time;
        $AC->post($url, $options);
        $col += 1;
    }
    $row += 1;
}
$AC->execute(5);
# Destroying
unset($AC);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
# Callback function example
function callback_function($response, $info, $request)
{
    global $objPHPExcel, $time_array, $amount_array;
    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']);
Пример #3
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();
$filename = "emails.txt";
$emails = file($filename, FILE_IGNORE_NEW_LINES);
# Basic request usage (for extended - see demo folder)
foreach ($emails as $email) {
    $url = "http://domw.net/data.php";
    $post_data = array('name' => 'email', 'cmd' => $email);
    $AC->post($url, $post_data);
}
# 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']);
        preg_match("/style='color:#008736'>Успешное соединение/", $response, $m);