Exemple #1
0
<?php

namespace ProxyChecker;

include __DIR__ . '/ProxyChecker.php';
$pingUrl = 'http://yourdomain.com/ProxyChecker/ping.php';
$proxyChecker = new ProxyChecker($pingUrl);
$proxies = array('183.95.132.76:80', '195.5.18.41:8118');
$results = $proxyChecker->checkProxies($proxies);
echo '<pre>';
var_export($results);
echo '</pre';
<?php

# Setting time and memory limits
ini_set('max_execution_time', 0);
ini_set('memory_limit', '128M');
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';
# Extending with proxy export method
class ProxyChecker extends AngryCurl
{
    public function export_proxy_list()
    {
        header('Content-type: text/plain');
        header('Content-Disposition: attachment; filename="proxy_list.txt"');
        echo implode("\r\n", $this->array_proxy);
    }
}
$AC = new ProxyChecker();
$AC->__set('window_size', 200);
$AC->load_proxy_list(AC_DIR . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR . 'proxy_list.txt', 200, 'http', 'http://google.com', 'title>G[o]{2}gle');
$AC->export_proxy_list();