當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Proxy類代碼示例

本文整理匯總了PHP中Proxy的典型用法代碼示例。如果您正苦於以下問題:PHP Proxy類的具體用法?PHP Proxy怎麽用?PHP Proxy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Proxy類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testProxy

 public function testProxy()
 {
     $expect = "<strong>I’ll be back!</strong>";
     $proxy = new Proxy();
     $result = $proxy->send();
     $this->assertEquals($result, $expect);
 }
開發者ID:AlexanderGrom,項目名稱:php-patterns,代碼行數:7,代碼來源:proxy_test.php

示例2: testGetAdditionalHtmlAttribute

 public function testGetAdditionalHtmlAttribute()
 {
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Framework\\Translate\\Inline')->will($this->returnValue($this->translateMock));
     $this->objectManagerMock->expects($this->never())->method('get');
     $this->translateMock->expects($this->exactly(2))->method('getAdditionalHtmlAttribute')->with($this->logicalOr('some_value', null))->will($this->returnArgument(0));
     $model = new Proxy($this->objectManagerMock, 'Magento\\Framework\\Translate\\Inline', false);
     $this->assertEquals('some_value', $model->getAdditionalHtmlAttribute('some_value'));
     $this->assertNull($model->getAdditionalHtmlAttribute());
 }
開發者ID:,項目名稱:,代碼行數:9,代碼來源:

示例3: enable_step

 function enable_step($old_state)
 {
     global $phpEx;
     global $phpbb_root_path;
     global $request;
     /*Require WP includes*/
     $proxy = new Proxy();
     $proxy->cache();
     //AAAAAAAAAAAAND let's hope it works?
     // Run parent enable step method
     return parent::enable_step($old_state);
 }
開發者ID:hell4ween,項目名稱:phpbbwpunicorn,代碼行數:12,代碼來源:ext.php

示例4: getProxy

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;
    }
}
開發者ID:agusnurwanto,項目名稱:vat-ebay-web-scrapping,代碼行數:12,代碼來源:scrape.php

示例5: testConstructor

 /**
  * Tests setting the name and body using the Notification class Constructor.
  */
 public function testConstructor()
 {
     // Create a new Proxy using the Constructor to set the name and data
     $proxy = new Proxy('colors', array('red', 'green', 'blue'));
     $data = $proxy->getData();
     // test assertions
     $this->assertNotNull($proxy, "Expecting proxy not null");
     $this->assertTrue($proxy->getProxyName() == 'colors', "Expecting proxy.getProxyName() == 'colors'");
     $this->assertTrue(sizeof($data) == 3, "Expecting data.length == 3");
     $this->assertTrue($data[0] == 'red', "Expecting data[0] == 'red'");
     $this->assertTrue($data[1] == 'green', "Expecting data[1] == 'green'");
     $this->assertTrue($data[2] == 'blue', "Expecting data[2] == 'blue'");
 }
開發者ID:pkdevboxy,項目名稱:puremvc-php-standard-unittests,代碼行數:16,代碼來源:ProxyTest.php

示例6: cAuthorize

 /**
  * check authorize info
  */
 private function cAuthorize()
 {
     $return = Proxy::getAuthorize();
     if ($return == false) {
         $this->safeInfo[] = array('content' => '歡迎您使用尚普商城。');
     }
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:10,代碼來源:safestrategy.php

示例7: getUrl

 public function getUrl($url, $timeout = 5)
 {
     $this->initInstance();
     curl_setopt($this->ch, CURLOPT_URL, $url);
     curl_setopt($this->ch, CURLOPT_TIMEOUT, intval($timeout));
     if ($this->cookie) {
         curl_setopt($this->ch, CURLOPT_COOKIE, $this->cookie);
     }
     if (is_array($this->use_proxy)) {
         $retry = $this->use_proxy ? 1 : 3;
         for ($i = 0; $i < $retry; $i++) {
             $proxy = $this->use_proxy ?: Proxy::rand();
             //允許手動指定Proxy配置
             curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $proxy['delay']);
             curl_setopt($this->ch, CURLOPT_PROXY, $proxy['host']);
             curl_setopt($this->ch, CURLOPT_PROXYTYPE, $proxy['type']);
             $result = curl_exec($this->ch);
             if ($result && !curl_errno($this->ch)) {
                 break;
             }
         }
     } else {
         $result = curl_exec($this->ch);
     }
     return curl_errno($this->ch) ? false : $result;
 }
開發者ID:ezc,項目名稱:Toolkit,代碼行數:26,代碼來源:UrlFetcher.php

示例8: errorHandler

 function errorHandler()
 {
     if (!empty($this->current_fd)) {
         $rsp = Proxy::shutdown_handler();
         $rsp && $this->serv->send($this->current_fd, $rsp);
     }
 }
開發者ID:liangkwok,項目名稱:Swoole,代碼行數:7,代碼來源:fixed_header_server.php

示例9: deployBean

 /**
  * Deploy
  *
  * @param   remote.server.deploy.Deployable deployment
  */
 public function deployBean($deployment)
 {
     if ($deployment instanceof IncompleteDeployment) {
         throw new DeployException('Incomplete deployment originating from ' . $deployment->origin, $deployment->cause);
     }
     $this->cat && $this->cat->info($this->getClassName(), 'Begin deployment of', $deployment);
     // Register beans classloader. This classloader must be put at the beginning
     // to prevent loading of the home interface not implmenenting BeanInterface
     $cl = $deployment->getClassLoader();
     ClassLoader::getDefault()->registerLoader($cl, TRUE);
     $impl = $cl->loadClass($deployment->getImplementation());
     $interface = $cl->loadClass($deployment->getInterface());
     $directoryName = $deployment->getDirectoryName();
     // Fetch naming directory
     $directory = NamingDirectory::getInstance();
     // Create beanContainer
     // TBI: Check which kind of bean container has to be created
     $beanContainer = StatelessSessionBeanContainer::forClass($impl);
     $this->cat && $beanContainer->setTrace($this->cat);
     // Create invocation handler
     $invocationHandler = new ContainerInvocationHandler();
     $invocationHandler->setContainer($beanContainer);
     // Now bind into directory
     $directory->bind($directoryName, Proxy::newProxyInstance($cl, array($interface), $invocationHandler));
     $this->cat && $this->cat->info($this->getClassName(), 'End deployment of', $impl->getName(), 'with ND entry', $directoryName);
     return $beanContainer;
 }
開發者ID:melogamepay,項目名稱:xp-framework,代碼行數:32,代碼來源:Deployer.class.php

示例10: parse

 /**
  * Parses an XML string and returns a Proxy for it.
  * @param string|Proxy|null $xml
  * @param string $encoding The character set to use, defaults to UTF-8
  * @return Proxy
  */
 public function parse($xml = null, $encoding = null)
 {
     if (!$xml) {
         return Proxy(null);
     }
     if ($xml instanceof Proxy) {
         // already parsed
         return $xml->cloneNode();
     }
     $xml = (string) $xml;
     try {
         return $this->parseFull($xml, $encoding);
     } catch (\arc\UnknownError $e) {
         return $this->parsePartial($xml, $encoding);
     }
 }
開發者ID:poef,項目名稱:ariadne,代碼行數:22,代碼來源:Parser.php

示例11: create

 public static function create($batchId, $urlId, $proxyId, $updateBatch)
 {
     SystemUtility::log('PING START', true);
     SystemUtility::log('GATHERING DATA');
     # Update batch here in case something crashes below
     if ($updateBatch) {
         SystemUtility::log('THIS IS THE LAST PING IN BATCH');
         $batch = \Batch::findFirst();
         $batch->updatedAt = SystemUtility::getSqlNowDate();
         $batch->save();
     }
     $url = \Url::findFirst($urlId);
     $proxy = \Proxy::findFirst($proxyId);
     # Create new ping
     $ping = new \Ping();
     $ping->batchId = $batchId;
     $ping->proxyId = $proxyId;
     $ping->httpCode = self::HTTP_CODE_IN_PROGRESS;
     $ping->duration = 0;
     $ping->error = '';
     $ping->save();
     self::doPing($ping, $url, $proxy);
     SystemUtility::log('PING END');
     return $ping;
 }
開發者ID:sweetdevel,項目名稱:pingaroo,代碼行數:25,代碼來源:PingHelper.php

示例12: model

 public function model($route)
 {
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     $file = DIR_APPLICATION . 'model/' . $route . '.php';
     $class = 'Model' . preg_replace('/[^a-zA-Z0-9]/', '', $route);
     if (is_file($file)) {
         include_once $file;
         $proxy = new Proxy();
         foreach (get_class_methods($class) as $method) {
             $proxy->attach($method, $this->closure($this->registry, $route . '/' . $method));
         }
         $this->registry->set('model_' . str_replace(array('/', '-', '.'), array('_', '', ''), (string) $route), $proxy);
     } else {
         throw new \Exception('Error: Could not load model ' . $route . '!');
     }
 }
開發者ID:syslogic,項目名稱:opencart,代碼行數:17,代碼來源:loader.php

示例13: run

 public function run()
 {
     $i = 0;
     while ($i < 100) {
         $i++;
         $proxy = $this->proxy->getWorks();
         $this->connector->setProxy($proxy);
         $list = $this->parserFreeProxy->getIpList();
         //$response = $this->connector->getResponse('https://api.ipify.org');
         /*if($response == $proxy->ip){
         			echo 'works';
         		} else {
         			echo 'not wokrs';
         		}*/
         exit;
     }
 }
開發者ID:hadikcz,項目名稱:proxyList,代碼行數:17,代碼來源:Crawler.php

示例14: valueOf

 /**
  * Returns a value for the given serialized string
  *
  * @param   server.protocol.Serializer serializer
  * @param   remote.protocol.SerializedData serialized
  * @param   [:var] context default array()
  * @return  var
  */
 public function valueOf($serializer, $serialized, $context = array())
 {
     $oid = $serialized->consumeSize();
     $serialized->consume('{');
     $interface = $serializer->valueOf($serialized, $context);
     $serialized->consume('}');
     return Proxy::newProxyInstance(ClassLoader::getDefault(), array(XPClass::forName($serializer->packageMapping($interface))), RemoteInvocationHandler::newInstance((int) $oid, $context['handler']));
 }
開發者ID:melogamepay,項目名稱:xp-framework,代碼行數:16,代碼來源:RemoteInterfaceMapping.class.php

示例15: indexAction

 /**
  * The start action, it shows the "search" view
  */
 public function indexAction()
 {
     $searchParams = ['ping.batchId' => 'batchId', 'ping.proxyId' => 'proxyId', 'b.urlId' => 'urlId'];
     Tag::setDefaults(array('urlId' => $this->request->get('urlId'), 'proxyId' => $this->request->get('proxyId'), 'pingId' => $this->request->get('pingId'), 'batchId' => $this->request->get('batchId')));
     $this->view->pings = $this->searchPings($searchParams);
     $this->view->proxies = Proxy::find();
     $this->view->urls = Url::find();
     $this->view->batches = Batch::find();
     #$this->view->disable();
 }
開發者ID:sweetdevel,項目名稱:pingaroo,代碼行數:13,代碼來源:PingController.php


注:本文中的Proxy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。