本文整理汇总了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());
}
示例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()));
}
示例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]);
}
示例4: testHttpGet
public function testHttpGet()
{
$this->client->setMethod(Request::METHOD_GET);
$response= $this->client->send();
$this->assertTrue($response->isSuccess());
}