当前位置: 首页>>代码示例>>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;未经允许,请勿转载。