本文整理汇总了PHP中Zend_Http_Client::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Http_Client::post方法的具体用法?PHP Zend_Http_Client::post怎么用?PHP Zend_Http_Client::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Http_Client
的用法示例。
在下文中一共展示了Zend_Http_Client::post方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _sendRequest
/**
* Send a XML-RPC request to the service (for a specific method)
*
* @param string $method Name of the method we want to call
* @param array $params Array of Zend_XmlRpc_Value objects, parameters for the method
* @throws Zend_Http_Client_Exception
*/
protected function _sendRequest($method, $params = null)
{
$request_data = $this->_buildRequest($method, $params);
// @todo pluggable client?
$http = new Zend_Http_Client($this->_serverAddress, array('Content-Type: text/xml'));
$response = $http->post($request_data);
/* @var $response Zend_Http_Response */
return $this->_parseResponse($response->getBody());
}
示例2: urlencode
<?php
set_include_path('/storage/htdocs/testing/ZendFramework-0.1.5/library');
require_once 'Zend/Http/Client.php';
// Instantiate our client object
$http = new Zend_Http_Client();
// Set the URI to a POST data processor
$http->setUri('http://unicron.bla/testing/server.php');
// Save specific GET variables as HTTP POST data
$postData = 'foo=' . urlencode('this is foo') . '&bar=' . urlencode('this is bar');
// Make the HTTP POST request and save the HTTP response
$httpResponse = $http->post($postData);
echo $httpResponse->getBody();