function getProxy() { if (!empty($_GET['radomProxy'])) { require __DIR__ . '/library/getProxy.php'; $hoge = new Proxy(); $hoge->setRandomProxyAndPort(); $proxy = $hoge->getProxy() . ":" . $hoge->getPort(); return $proxy; } else { return false; } }
protected function setOptionProxy(&$descriptor) { if (is_object($this->proxy)) { $proxy = $this->proxy->getProxy($descriptor['descriptor_key'], $descriptor['option'][CURLOPT_URL]); if (is_string($proxy['proxy']) && DryPath::isIp($proxy['proxy'])) { $this->setOption($descriptor, CURLOPT_PROXY, $proxy['proxy']); } else { $descriptor['option'][CURLOPT_URL] = false; } } elseif (is_string($this->proxy)) { $this->setOption($descriptor, CURLOPT_PROXY, $this->proxy); } }
public static function main(array $args = array()) { $location = array("localhost:10000", "localhost:10000", "localhost:10000"); $monitor = array(); for ($i = 0; $i < count($location); $i++) { $machine = Proxy::getProxy($location[$i]); $monitor[$i] = new GumballMonitor($machine); println($monitor[$i]); } for ($i = 0; $i < count($monitor); $i++) { $monitor[$i]->report(); } }
<?php require_once "../../../bootstrap.php"; require_once "custom/Proxy.php"; $args = $_SERVER["argv"]; println("Stopping server " . $args[0]); $proxy = Proxy::getProxy($args[0]); $proxy->shutdown();