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


PHP Zend_Http_Client_Adapter_Interface::addOption方法代码示例

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


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

示例1: _postBack

 /**
  * Post back to PayPal to check whether this request is a valid one
  *
  * @param  Zend_Http_Client_Adapter_Interface $httpAdapter
  * @throws Exception
  */
 protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter)
 {
     $sReq = '';
     foreach ($this->_request as $k => $v) {
         $sReq .= '&' . $k . '=' . urlencode(stripslashes($v));
     }
     $sReq .= "&cmd=_notify-validate";
     $sReq = substr($sReq, 1);
     $this->_debugData['postback'] = $sReq;
     $this->_debugData['postback_to'] = $this->_config->getPaypalUrl();
     $httpAdapter->addOption(CURLOPT_SSLVERSION, 6);
     //6 == CURL_SSLVERSION_TLSv1_2
     $httpAdapter->write(Zend_Http_Client::POST, $this->_config->getPaypalUrl(), '1.1', array(), $sReq);
     try {
         $response = $httpAdapter->read();
     } catch (Exception $e) {
         $this->_debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
         throw $e;
     }
     $this->_debugData['postback_result'] = $response;
     // =====================================================================
     // Changed from default code.  Paypal now regularly returns a 100
     // response with an empty body followed by a 200 response with the
     // VERIFIED/INVALID message.  The code below will check the last
     // response for the VERIFIED/INVALID code rather than the first.
     //
     // ref: http://www.dhmedia.com.au/blog/debugging-paypal-ipn-postback-failure-magent
     // Magento 2 Pull Request: https://github.com/magento/magento2/pull/136
     $response = preg_split('/^\\r?$/m', $response);
     $response = trim(end($response));
     // =====================================================================
     if ($response != 'VERIFIED') {
         throw new Exception('PayPal IPN postback failure. See ' . self::DEFAULT_LOG_FILE . ' for details.');
     }
     unset($this->_debugData['postback'], $this->_debugData['postback_result']);
 }
开发者ID:helirexi,项目名称:Magento-Paypalfixes,代码行数:42,代码来源:Ipn.php


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