public function testGet() { $listName = 'bpteam'; $proxyIp = '127.0.0.1:8080'; $properties = ['anonym' => false, 'referer' => true, 'post' => true, 'get' => true, 'cookie' => false, 'country' => 'China', 'last_check' => 13255444887.0, 'starttransfer' => 21, 'upload_speed' => 1, 'download_speed' => 2, 'source' => ['proxy.net'], 'protocol' => ['http']]; $proxy = new Proxy(); $proxy->open($listName); $proxy->add($proxyIp, $properties); $getProxy = $proxy->get(); $this->assertTrue(is_array($getProxy)); $this->assertArrayHasKey('proxy', $getProxy); $this->assertEquals($proxyIp, $getProxy['proxy']); }
* Created by PhpStorm. * User: EC_l * Date: 27.02.14 * Time: 9:05 * Email: bpteam22@gmail.com */ use bpteam\ProxyList\Proxy; ?> <form method="post"> <input type="text" name="list_name" value="<?php echo isset($_POST['list_name']) ? $_POST['list_name'] : ''; ?> "> List name<br/> <? if(isset($_POST['list_name'])){ $proxy = new Proxy(); $proxy->open($_POST['list_name']); if(isset($_POST['send_form'])){ $proxy->write($_POST['url'], 'url'); $proxy->write(explode("\n",$_POST['check_word']), 'check_word'); $functions = array(); foreach ($proxy->getProxyFunction() as $function) { if($function == 'country') continue; if(isset($_POST['function_'.$function])){ $functions[] = $function; } } if($_POST['country']){ $proxy->write(explode("\n",$_POST['country']), 'country'); } $proxy->write($functions, 'function');
function __construct($checkUrl = 'http://test1.ru/proxy_check.php', $port = 80, $serverIp = false, $urlCheckServerIp = 'http://bpteam.net/server_ip.php') { parent::__construct(); $this->loader = new Loader('LoaderMultiCurl'); $this->setUrlCheckServerIp($urlCheckServerIp); $this->loader->setTypeContent('file'); $this->loader->setSleepTime(500000); $this->loader->setDefaultOption(CURLOPT_PORT, $port); $this->loader->setDefaultOption(CURLOPT_TIMEOUT, 15); $this->setModulesDir(__DIR__ . '/modules'); $this->setSourceDir(__DIR__ . '/proxy_list/source'); $this->setFunctionUrl($checkUrl); $this->setServerIp($serverIp); }