if ($newxml) { $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();
define('AC_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR . '..'); # 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(); $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 <?
/* NOTE: IF USING request() - "on the fly" proxy server changing WILL apply * * You may use request(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 */ $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
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(); $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);