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


PHP Zend_Http_Client::send方法代码示例

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


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

示例1: testContentTypeAdditionlInfo

 /**
  * @group ZF2-78
  * @dataProvider parameterArrayProvider
  */
 public function testContentTypeAdditionlInfo($params)
 {
     $content_type = 'application/x-www-form-urlencoded; charset=UTF-8';
     $this->client->setUri($this->baseuri . 'testPostData.php');
     $this->client->setHeaders(array('Content-Type' => $content_type));
     $this->client->setMethod(\Zend\Http\Request::METHOD_POST);
     $this->client->setParameterPost($params);
     $this->client->send();
     $request = Request::fromString($this->client->getLastRawRequest());
     $this->assertEquals($content_type, $request->headers()->get('Content-Type')->getFieldValue());
 }
开发者ID:nsenkevich,项目名称:zf2,代码行数:15,代码来源:CommonHttpTests.php

示例2: testZF9404DoubleContentLengthHeader

 /**
  * Test that we can deal with double Content-Length headers
  *
  * @link http://framework.zend.com/issues/browse/ZF-9404
  */
 public function testZF9404DoubleContentLengthHeader()
 {
     $this->client->setUri($this->baseuri . 'ZF9404-doubleContentLength.php');
     $expect = filesize(dirname(realpath(__FILE__)) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ZF9404-doubleContentLength.php');
     $response = $this->client->send();
     if (!$response->isSuccess()) {
         throw new AdapterException\RuntimeException("Error requesting test URL");
     }
     $clen = $response->headers()->get('Content-Length');
     if (!is_array($clen)) {
         $this->markTestSkipped("Didn't get multiple Content-length headers");
     }
     $this->assertEquals($expect, strlen($response->getBody()));
 }
开发者ID:RomanShumkov,项目名称:zf2,代码行数:19,代码来源:CommonHttpTests.php

示例3: testMultibyteRawPostDataZF2098

 /**
  * Test that we properly calculate the content-length of multibyte-encoded
  * request body
  *
  * This may file in case that mbstring overloads the substr and strlen
  * functions, and the mbstring internal encoding is a multibyte encoding.
  *
  * @link http://framework.zend.com/issues/browse/ZF-2098
  */
 public function testMultibyteRawPostDataZF2098()
 {
     $this->_client->setAdapter('Zend\\Http\\Client\\Adapter\\Test');
     $this->_client->setUri('http://example.com');
     $bodyFile = __DIR__ . '/_files/ZF2098-multibytepostdata.txt';
     $this->_client->setRawBody(file_get_contents($bodyFile));
     $this->_client->setEncType('text/plain');
     $this->_client->setMethod('POST');
     $this->_client->send();
     $request = $this->_client->getLastRequest();
     if (!preg_match('/^content-length:\\s+(\\d+)/mi', $request, $match)) {
         $this->fail("Unable to find content-length header in request");
     }
     $this->assertEquals(filesize($bodyFile), (int) $match[1]);
 }
开发者ID:alab1001101,项目名称:zf2,代码行数:24,代码来源:StaticTest.php

示例4: testHttpGet

 public function testHttpGet()
 {
     $this->client->setMethod(Request::METHOD_GET);
     $response= $this->client->send();
     $this->assertTrue($response->isSuccess());
 }
开发者ID:rukavina,项目名称:zf2,代码行数:6,代码来源:UseCaseTest.php


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