我正在尝试使用Yii客户端(正在开发中)重写以下HTTP请求,这在使用ZEND HTTP客户端的文档中得到了例证:
// Create Http client to send the paymentRequest
// We use Zend_Http_Client here, feel free to use your favourite HTTP client library
$client = new Zend_Http_Client($this->donationRequest->getSipsUri());
$client->setParameterPost('Data', $this->donationRequest->toParameterString());
$client->setParameterPost('InterfaceVersion', 'HP_2.3');
$client->setParameterPost('Seal', $this->donationRequest->getShaSign());
$response = $client->request(Zend_Http_Client::POST);使用Yii,这就是我想出的:
$client = new Client();
$data = [
'Data' => $this->donationRequest->toParameterString(),
'InterfaceVersion' => 'HP_2.3',
'Seal' => $this->donationRequest->getShaSign()
];
$client->createRequest()
->setMethod('post')
->setUrl($this->donationRequest->getSipsUri())
->setData($data)->send();在启动此代码时,我会得到以下错误:
fopen(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname 如何正确地调试问题(即查看提交的内容并使用结果通过浏览器解决方案进行测试)?
使用Yii替代方案提出类似Zend示例的请求的任何建议
发布于 2015-11-19 15:26:13
我使用了口香糖,它很好地处理了Yii2,并且有一个足够简单的界面。谢谢
https://stackoverflow.com/questions/32924879
复制相似问题