示例#1
0
            $search_results = $newxml->xpath($scrubber_xml->xpath->domain);
            if (!empty($search_results)) {
                foreach ($search_results as $search_result) {
                    $domain = $search_result->div[0]->span->__toString();
                    $rank = explode(" ", $search_result->div[1]->span->attributes()->class->__toString())[1];
                    if ($rank == "r1" || $rank == "r2") {
                        file_put_contents("domains.txt", $domain . PHP_EOL, FILE_APPEND);
                    }
                }
            }
        }
        AngryCurl::add_debug_msg("->\t" . $request->options[CURLOPT_PROXY] . "\tOKAY\t" . $info['http_code'] . "\t" . $info['total_time'] . "\t" . $info['url']);
        return;
    }
    echo "nothing happens!\n";
}
$AC = new AngryCurl('nothing');
$AC->__set('window_size', 20);
$AC->load_useragent_list('./lib/useragent_list.txt');
$AC->__set('use_proxy_list', false);
$AC->__set('use_useragent_list', true);
$doc = new DOMDocument();
$doc->strictErrorChecking = FALSE;
$doc->load("config.xml");
$scrubber_xml = simplexml_import_dom($doc);
$xml = new SimpleXMLElement('<xml/>');
for ($i = 199; $i < 999; $i++) {
    $AC->get("https://www.mywot.com/en/scorecard?page=" . $i);
}
$AC->execute();
示例#2
0
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']);
    } else {
        AngryCurl::add_debug_msg("->\t" . $request->options[CURLOPT_PROXY] . "\tOK\t" . $info['http_code'] . "\t" . $info['total_time'] . "\t" . $info['url']);
        preg_match("/Значение комиссии: (.*?)</", $response, $m);
        $commision = str_replace(' Руб.', '', $m[1]);
        $row = array_search($request->post_data['money'], $amount_array) + 2;
$AC->load_useragent_list(AC_DIR . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR . 'useragent_list.txt');
?>

# Adding first 10 requests

<?
for($i=1; $i<=10; $i++)
    $AC->get("http://ya.ru/?$i");
?>

# Starting with number of threads = 10
# After each of first 5 finished request - new one will be added
# They all will proceed to execute immediatly (see callback_function)

<?
$AC->execute(10);
?>

# Totally run 15 requests

# Let's add 2 more

<?
$AC->get('http://ya.ru/?after_finished_1');
$AC->get('http://ya.ru/?after_finished_2');
?>

# Nothing happend, lets run execute() again

<?
$AC->execute(10);
 */
$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);
# 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;
}
示例#5
0
# Initializing so called 'web-console mode' with direct cosnole-like output
$AC->init_console();
$filexml = 'sitemap.xml';
$urls = array();
if (file_exists($filexml)) {
    $sitemap = simplexml_load_file($filexml);
    foreach ($sitemap as $url) {
        $urls[] = $url->loc;
    }
}
# Basic request usage (for extended - see demo folder)
foreach ($urls as $url) {
    $AC->get($url);
}
# Starting with number of threads = 3
$AC->execute(2);
# 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("/html;/", $info['content_type'], $find_content_type);
        if (isset($find_content_type[0])) {
            $doc = new DOMDocument();
            $doc->loadHTML($response);