当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::getCurlMulti方法代码示例

本文整理汇总了PHP中Guzzle\Http\Client::getCurlMulti方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getCurlMulti方法的具体用法?PHP Client::getCurlMulti怎么用?PHP Client::getCurlMulti使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Guzzle\Http\Client的用法示例。


在下文中一共展示了Client::getCurlMulti方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testTrimsDownMaxHandleCount

 public function testTrimsDownMaxHandleCount()
 {
     $this->getServer()->flush();
     $this->getServer()->enqueue(array("HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", "HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", "HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", "HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
     $client = new Client($this->getServer()->getUrl());
     $client->setCurlMulti(new CurlMultiProxy(2));
     $request = $client->get();
     $request->send();
     $this->assertEquals(200, $request->getResponse()->getStatusCode());
     $handles = $this->readAttribute($client->getCurlMulti(), 'handles');
     $this->assertEquals(2, count($handles));
 }
开发者ID:ludichrislyts,项目名称:fieldWork,代码行数:12,代码来源:CurlMultiProxyTest.php

示例2: testCatchesExceptionsWhenRemovingQueuedRequestsBeforeSending

 public function testCatchesExceptionsWhenRemovingQueuedRequestsBeforeSending()
 {
     $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
     $client = new Client($this->getServer()->getUrl());
     $r = $client->get();
     $r->getEventDispatcher()->addListener('request.before_send', function () use($client) {
         // Create a request using a queued response
         $client->get()->setResponse(new Response(404), true)->send();
     });
     try {
         $r->send();
         $this->fail('Did not throw');
     } catch (BadResponseException $e) {
         $this->assertCount(0, $client->getCurlMulti());
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:16,代码来源:CurlMultiTest.php

示例3: testDontReuseCurlMulti

 public function testDontReuseCurlMulti()
 {
     $client1 = new Client();
     $client2 = new Client();
     $this->assertNotSame($client1->getCurlMulti(), $client2->getCurlMulti());
 }
开发者ID:carlesgutierrez,项目名称:libreobjet.org,代码行数:6,代码来源:ClientTest.php


注:本文中的Guzzle\Http\Client::getCurlMulti方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。