示例#1
1
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);
            $metas = $doc->getElementsByTagName('meta');
            $description = "";
            foreach ($metas as $meta) {
                if (strtolower($meta->getAttribute('name')) == 'description') {
                    $content = $meta->getAttribute('content');
                    $description = iconv("UTF-8", "windows-1251", $content);
                }
            }
            $fp = fopen("output_sitemap.csv", 'a');
            $turl = iconv("UTF-8", "windows-1251", $info['url']);
            fputcsv($fp, array($turl, $description), ';');
            fclose($fp);
        }
    }
    return;
}
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;
}
示例#3
1
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;
        $col = array_search($request->post_data['dd'], $time_array) + 1;
        $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $commision);
        set_commision_style($col, $row);
    }
    return;
}
示例#4
1
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);
        if (!empty($m)) {
            $data = $request->post_data['cmd'] . ':OK' . PHP_EOL;
        } else {
            $data = $request->post_data['cmd'] . ':FAIL' . PHP_EOL;
        }
        $fp = fopen('result.txt', 'a');
        fwrite($fp, $data);
    }
    return;
}
 public function __construct($message = "", $code = 0)
 {
     AngryCurl::add_debug_msg($message);
     parent::__construct($message, $code);
 }
function callback_function($response, $info, $request)
{
    global $AC;
    static $count=0;
    
    if($count<5)
    {
        $count++;
        $AC->get("http://ya.ru/?callback$count");
    }
    
    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;
}
示例#7
0
function nothing($response, $info, $request)
{
    global $xml, $scrubber_xml;
    if ($info['http_code'] !== 200) {
        AngryCurl::add_debug_msg("->\t" . $request->options[CURLOPT_PROXY] . "\tFAEL\t" . $info['http_code'] . "\t" . $info['total_time'] . "\t" . $info['url']);
        return;
    } else {
        $newxml = getXMLByDataHTML($response);
        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";
}
示例#8
0
 /**
  * Proxy list loading and filtering method
  *
  * @access public
  * 
  * @param string/array $input Input proxy data, could be an array or filename
  * @param enum(http/socks5) $proxy_type
  * @param string $proxy_test_url URL needed for proxy test requests
  * @param regexp $proxy_valid_regexp Regexp needed to be shure that response hasn`t been modified by proxy
  * 
  * @return bool
  */
 public function load_proxy_list($input, $proxy_type = 'http', $proxy_test_url = 'http://google.com', $proxy_valid_regexp = null)
 {
     # writing debug
     self::add_debug_msg("# Start loading proxies");
     # defining proxiess
     if (is_array($input)) {
         $this->array_proxy = $input;
     } else {
         $this->array_proxy = $this->load_from_file($input);
         # removing duplicates
         $n_dup = count($this->array_proxy);
         $this->array_proxy = array_unique($this->array_proxy);
         $n_dup -= count($this->array_proxy);
         self::add_debug_msg("Removed duplicates: {$n_dup}");
         unset($n_dup);
     }
     # setting amount
     $this->n_proxy = count($this->array_proxy);
     # setting proxy type
     if ($proxy_type == 'socks5') {
         self::add_debug_msg("Proxy type: SOCKS5");
         $this->__set('options', array(CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5));
     } else {
         self::add_debug_msg("Proxy type: HTTP");
     }
     # setting url for testing proxies
     $this->proxy_test_url = $proxy_test_url;
     # setting regexp for testing proxies
     if (!empty($proxy_valid_regexp)) {
         self::$proxy_valid_regexp = $proxy_valid_regexp;
         self::add_debug_msg("Proxy test RegExp: " . self::$proxy_valid_regexp);
     }
     # writing debug
     self::add_debug_msg("Proxy test URL: {$this->proxy_test_url}");
     self::add_debug_msg("Loaded proxies: {$this->n_proxy}");
     # filtering alive proxies
     if ($this->n_proxy > 0) {
         $this->filter_alive_proxy();
     } else {
         self::add_debug_msg("# Testing proxies aborted");
     }
 }