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


PHP Varien_Http_Adapter_Curl::getError方法代码示例

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


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

示例1: _call

 /**
  * Make a call to Payment Bridge service with given request parameters
  *
  * @param array $request
  * @return array
  * @throws Mage_Core_Exception
  */
 protected function _call(array $request)
 {
     $response = null;
     $debugData = array('request' => $request);
     try {
         $http = new Varien_Http_Adapter_Curl();
         $config = array('timeout' => 30);
         $http->setConfig($config);
         $http->write(Zend_Http_Client::POST, $this->getPbridgeEndpoint(), '1.1', array(), $this->_prepareRequestParams($request));
         $response = $http->read();
         $http->close();
     } catch (Exception $e) {
         $debugData['result'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
         $this->_debug($debugData);
         throw $e;
     }
     $this->_debug($response);
     if ($response) {
         $response = preg_split('/^\\r?$/m', $response, 2);
         $response = Mage::helper('core')->jsonDecode(trim($response[1]));
         $debugData['result'] = $response;
         $this->_debug($debugData);
         if ($http->getErrno()) {
             Mage::logException(new Exception(sprintf('Payment Bridge CURL connection error #%s: %s', $http->getErrno(), $http->getError())));
             Mage::throwException(Mage::helper('enterprise_pbridge')->__('Unable to communicate with Payment Bridge service.'));
         }
         if (isset($response['status']) && $response['status'] == 'Success') {
             $this->_response = $response;
             return true;
         }
     }
     $this->_handleError($response);
     $this->_response = $response;
     return false;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:42,代码来源:Api.php

示例2: send

 /**
  * This method will send call to external end points using GET or POST method
  * 
  * @param type $apiType url that needs to be called
  * @param type $requestType GET or POST
  * @param type $data model data that needs to be send with url 
  * @return type json
  * @throws Exception
  */
 public function send($apiType, $requestType, $data)
 {
     $curlAdapter = new Varien_Http_Adapter_Curl();
     $curlAdapter->setConfig(array('timeout' => 20));
     $body_param = Mage::helper('core')->jsonEncode($data);
     $header = $this->getHeader();
     try {
         $curlAdapter->write($requestType, $apiType, '1.1', $header, $body_param);
         $result = $curlAdapter->read();
         $response = preg_split('/^\\r?$/m', $result, 2);
         $response = trim($response[1]);
         $res = NULL;
         if (!is_null($response) && !empty($response)) {
             $res = Mage::helper('core')->jsonDecode($response);
         } else {
             Mage::log('Encountered problems trying to contact Terapeak');
             Mage::log($curlAdapter->getError());
         }
     } catch (Exception $e) {
         //eat the execption. We should not crash the magento instance if our extention throws exceptions
         Mage::log('Exception when trying to send data to Terapeak:');
         Mage::log($e);
     }
     return $res;
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:34,代码来源:Abstract.php

示例3: call

 /**
  * Do the API call
  *
  * @param string $methodName
  * @param array $request
  * @return array
  * @throws Mage_Core_Exception
  */
 public function call($methodName, array $request)
 {
     $request = $this->_addMethodToRequest($methodName, $request);
     $eachCallRequest = $this->_prepareEachCallRequest($methodName);
     if ($this->getUseCertAuthentication()) {
         if ($key = array_search('SIGNATURE', $eachCallRequest)) {
             unset($eachCallRequest[$key]);
         }
     }
     $request = $this->_exportToRequest($eachCallRequest, $request);
     $debugData = array('url' => $this->getApiEndpoint(), $methodName => $request);
     try {
         $http = new Varien_Http_Adapter_Curl();
         $config = array('timeout' => 30, 'verifypeer' => $this->_config->verifyPeer);
         if ($this->getUseProxy()) {
             $config['proxy'] = $this->getProxyHost() . ':' . $this->getProxyPort();
         }
         if ($this->getUseCertAuthentication()) {
             $config['ssl_cert'] = $this->getApiCertificate();
         }
         $http->setConfig($config);
         $http->write(Zend_Http_Client::POST, $this->getApiEndpoint(), '1.1', $this->_headers, $this->_buildQuery($request));
         $response = $http->read();
     } catch (Exception $e) {
         $debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
         $this->_debug($debugData);
         throw $e;
     }
     $response = preg_split('/^\\r?$/m', $response);
     $response = trim(end($response));
     $response = $this->_deformatNVP($response);
     $debugData['response'] = $response;
     $this->_debug($debugData);
     $response = $this->_postProcessResponse($response);
     // handle transport error
     if ($http->getErrno()) {
         Mage::logException(new Exception(sprintf('PayPal NVP CURL connection error #%s: %s', $http->getErrno(), $http->getError())));
         $http->close();
         Mage::throwException(Mage::helper('paypal')->__('Unable to communicate with the PayPal gateway.'));
     }
     // cUrl resource must be closed after checking it for errors
     $http->close();
     if (!$this->_validateResponse($methodName, $response)) {
         Mage::logException(new Exception(Mage::helper('paypal')->__("PayPal response hasn't required fields.")));
         Mage::throwException(Mage::helper('paypal')->__('There was an error processing your order. Please contact us or try again later.'));
     }
     $this->_callErrors = array();
     if ($this->_isCallSuccessful($response)) {
         if ($this->_rawResponseNeeded) {
             $this->setRawSuccessResponseData($response);
         }
         return $response;
     }
     $this->_handleCallErrors($response);
     return $response;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:64,代码来源:Nvp.php

示例4: _post

 /**
  * Post a request, note that for a HTTPS URL no port is required
  *
  * @param string $url
  * @param string $path
  * @param array  $params
  * @return mixed
  */
 protected function _post($url, $timeout, $dataToSend)
 {
     $config = array('timeout' => 30);
     $this->_http->setConfig($config);
     $this->_http->write(Zend_Http_Client::POST, $url, '1.1', array(), $dataToSend);
     $response = $this->_http->read();
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     if ($this->_http->getErrno()) {
         $this->_http->close();
         $this->setError($this->_http->getErrno() . ':' . $this->_http->getError());
         return false;
     }
     $this->_http->close();
     return $response;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:24,代码来源:Advanced.php

示例5: call

 /**
  * Function to perform the API call to PayPal using API signature
  *
  * @param $methodName string is name of API  method.
  * @param $nvpArr array NVP params array
  * @return array|boolean an associtive array containing the response from the server or false in case of error.
  */
 public function call($methodName, array $nvpArr)
 {
     $nvpArr = array_merge(array('METHOD' => $methodName, 'VERSION' => $this->getVersion(), 'USER' => $this->getApiUserName(), 'PWD' => $this->getApiPassword(), 'SIGNATURE' => $this->getApiSignature()), $nvpArr);
     $nvpReq = '';
     foreach ($nvpArr as $k => $v) {
         $nvpReq .= '&' . $k . '=' . urlencode($v);
     }
     $nvpReq = substr($nvpReq, 1);
     if ($this->getDebug()) {
         $debug = Mage::getModel('paypal/api_debug')->setApiEndpoint($this->getApiEndpoint())->setRequestBody($nvpReq)->save();
     }
     $http = new Varien_Http_Adapter_Curl();
     $config = array();
     if ($this->getUseProxy()) {
         $config['proxy'] = $this->getProxyHost() . ':' . $this->getProxyPort();
     }
     $http->setConfig($config);
     $http->write(Zend_Http_Client::POST, $this->getApiEndpoint(), '1.1', array(), $nvpReq);
     $response = $http->read();
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     if ($this->getDebug()) {
         $debug->setResponseBody($response)->save();
     }
     $nvpReqArray = $this->deformatNVP($nvpReq);
     $this->getSession()->setNvpReqArray($nvpReqArray);
     if ($http->getErrno()) {
         $http->close();
         $this->setError(array('type' => 'CURL', 'code' => $http->getErrno(), 'message' => $http->getError()));
         $this->setRedirectUrl($this->getApiErrorUrl());
         return false;
     }
     $http->close();
     //converting NVPResponse to an Associative Array
     $nvpResArray = $this->deformatNVP($response);
     $this->getSession()->setLastCallMethod($methodName)->setResHash($nvpResArray);
     $ack = strtoupper($nvpResArray['ACK']);
     if ($ack == 'SUCCESS') {
         $this->unsError();
         return $nvpResArray;
     }
     $errorArr = array('type' => 'API', 'ack' => $ack);
     if (isset($nvpResArray['VERSION'])) {
         $errorArr['version'] = $nvpResArray['VERSION'];
     }
     if (isset($nvpResArray['CORRELATIONID'])) {
         $errorArr['correlation_id'] = $nvpResArray['CORRELATIONID'];
     }
     for ($i = 0; isset($nvpResArray['L_SHORTMESSAGE' . $i]); $i++) {
         $errorArr['code'] = $nvpResArray['L_ERRORCODE' . $i];
         $errorArr['short_message'] = $nvpResArray['L_SHORTMESSAGE' . $i];
         $errorArr['long_message'] = $nvpResArray['L_LONGMESSAGE' . $i];
     }
     $this->setError($errorArr);
     $this->setRedirectUrl($this->getApiErrorUrl());
     return false;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:64,代码来源:Nvp.php

示例6: call

 /**
  * Do the API call
  *
  * @param string $methodName
  * @param array $request
  * @return array
  * @throws Mage_Core_Exception
  */
 public function call($methodName, array $request)
 {
     $request = $this->_addMethodToRequest($methodName, $request);
     $eachCallRequest = $this->_prepareEachCallRequest($methodName);
     $request = $this->_exportToRequest($eachCallRequest, $request);
     $debugData = array('url' => $this->getApiEndpoint(), $methodName => $request);
     try {
         $http = new Varien_Http_Adapter_Curl();
         $config = array('timeout' => 30);
         if ($this->getUseProxy()) {
             $config['proxy'] = $this->getProxyHost() . ':' . $this->getProxyPort();
         }
         $http->setConfig($config);
         $http->write(Zend_Http_Client::POST, $this->getApiEndpoint(), '1.1', array(), $this->_buildQuery($request));
         $response = $http->read();
     } catch (Exception $e) {
         $debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
         $this->_debug($debugData);
         throw $e;
     }
     $http->close();
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     $response = $this->_deformatNVP($response);
     $debugData['response'] = $response;
     $this->_debug($debugData);
     // handle transport error
     if ($http->getErrno()) {
         Mage::logException(new Exception(sprintf('PayPal NVP CURL connection error #%s: %s', $http->getErrno(), $http->getError())));
         Mage::throwException(Mage::helper('paypal')->__('Unable to communicate with the PayPal gateway.'));
     }
     $this->_callErrors = array();
     if ($this->_isCallSuccessful($response)) {
         if ($this->_rawResponseNeeded) {
             $this->setRawSuccessResponseData($response);
         }
         return $response;
     }
     $this->_handleCallErrors($response);
     return $response;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:49,代码来源:Nvp.php

示例7: _processPostRequest

 /**
  * Send HTTP POST request to magentocommerce.com
  *
  * @return null
  */
 protected function _processPostRequest()
 {
     try {
         /** @var $app Mage_XmlConnect_Model_Application */
         $app = Mage::helper('xmlconnect')->getApplication();
         $params = $app->getSubmitParams();
         $appConnectorUrl = Mage::getStoreConfig('xmlconnect/mobile_application/magentocommerce_url');
         $curl = new Varien_Http_Adapter_Curl();
         $verifyPeerValue = Mage::getStoreConfig('xmlconnect/mobile_application/curl_ssl_verifypeer');
         $curl->setConfig(array('timeout' => Mage_XmlConnect_Helper_Data::CURLOPT_DEFAULT_TIMEOUT, 'verifypeer' => $verifyPeerValue, 'verifyhost' => 2, 'header' => false));
         $mCommerceUrl = $appConnectorUrl . $params['key'];
         $curl->write(Zend_Http_Client::POST, $mCommerceUrl, CURL_HTTP_VERSION_1_1, array(), $params);
         $result = $curl->read();
         if (false === $result) {
             Mage::log('Curl error: ' . $curl->getError());
             $curl->close();
             Mage::throwException($this->__('Request internal error.'));
         }
         $curl->close();
         // Assert that we received an expected message in reponse.
         $resultArray = json_decode($result, true);
         $app->setResult($result);
         $success = isset($resultArray['success']) && $resultArray['success'] === true;
         $app->setSuccess($success);
         if (!$app->getSuccess()) {
             $message = isset($resultArray['message']) ? $resultArray['message'] : '';
             if (is_array($message)) {
                 $message = implode(' ,', $message);
             }
             Mage::throwException($this->__('Submit App failure. %s', $message));
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:40,代码来源:MobileController.php

示例8: call

 /**
  * Do the API call
  *
  * @param string $methodName
  * @param array $request
  * @return array
  * @throws Mage_Core_Exception
  */
 public function call($methodName, array $request)
 {
     $request = $this->_addMethodToRequest($methodName, $request);
     $request = $this->_exportToRequest($this->_eachCallRequest, $request);
     if ($this->getDebug()) {
         $requestDebug = $request;
         foreach ($this->_debugReplacePrivateDataKeys as $key) {
             if (isset($request[$key])) {
                 $requestDebug[$key] = '***';
             }
         }
         $debug = Mage::getModel('paypal/api_debug')->setApiEndpoint($this->getApiEndpoint())->setRequestBody(var_export($requestDebug, 1))->save();
     }
     $http = new Varien_Http_Adapter_Curl();
     $config = array('timeout' => 30);
     if ($this->getUseProxy()) {
         $config['proxy'] = $this->getProxyHost() . ':' . $this->getProxyPort();
     }
     $http->setConfig($config);
     $http->write(Zend_Http_Client::POST, $this->getApiEndpoint(), '1.1', array(), $this->_buildQuery($request));
     $response = $http->read();
     $http->close();
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     $response = $this->_deformatNVP($response);
     if ($this->getDebug()) {
         $debug->setResponseBody(var_export($response, 1))->save();
     }
     // handle transport error
     if ($http->getErrno()) {
         Mage::logException(new Exception(sprintf('PayPal NVP CURL connection error #%s: %s', $http->getErrno(), $http->getError())));
         Mage::throwException(Mage::helper('paypal')->__('Unable to communicate with PayPal gateway.'));
     }
     if ($this->_isCallSuccessful($response)) {
         return $response;
     }
     $this->_handleCallErrors($response);
     return $response;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:47,代码来源:Nvp.php

示例9: _call

 protected function _call(Varien_Object $payment)
 {
     if ($this->getDebug()) {
         $writer = new Zend_Log_Writer_Stream($this->getLogPath());
         $logger = new Zend_Log($writer);
         $logger->info("entering _call()");
     }
     // Generate any needed values
     // Create expiry dat in format "MM/YY"
     $date_expiry = str_pad($payment->getCcExpMonth(), 2, '0', STR_PAD_LEFT) . '/' . substr($payment->getCcExpYear(), 2, 2);
     $transaction_id = $payment->getOrder()->getIncrementId();
     $messageTimestamp = date('YdmHis000000+000', time());
     if ($this->getDebug()) {
         $logger->info(var_export($payment->getOrder()->getData(), true));
     }
     // Build the XML request
     $doc = new SimpleXMLElement('<NABTransactMessage></NABTransactMessage>');
     $messageInfo = $doc->addChild('MessageInfo');
     $messageInfo->addChild('messageID', substr(md5($transaction_id . $messageTimestamp), 0, 30));
     $messageInfo->addChild('messageTimestamp', htmlentities($messageTimestamp));
     $messageInfo->addChild('timeoutValue', htmlentities('60'));
     $messageInfo->addChild('apiVersion', htmlentities('xml-4.2'));
     $merchantInfo = $doc->addChild('MerchantInfo');
     $merchantInfo->addChild('merchantID', htmlentities($this->getUsername()));
     $merchantInfo->addChild('password', htmlentities($this->getPassword()));
     $doc->addChild('RequestType', 'Payment');
     // Currently Nab only allows one transaction per request
     $txnList = $doc->addChild('Payment')->addChild('TxnList');
     $txnList->addAttribute('count', '1');
     //htmlentities($transaction_id)
     $txn = $txnList->addChild('Txn');
     $txn->addAttribute('ID', '1');
     // Currently must be set to "1"
     $txn->addChild('txnType', '0');
     // Set to "0" for payment
     $txn->addChild('txnSource', '23');
     // Set to "23" for SecureXML
     $txn->addChild('amount', htmlentities($this->getAmount() * 100));
     // In cents
     $txn->addChild('currency', htmlentities($payment->getOrder()->getBaseCurrencyCode()));
     $txn->addChild('purchaseOrderNo', htmlentities($transaction_id));
     $cc = $txn->addChild('CreditCardInfo');
     $cc->addChild('cardNumber', htmlentities($payment->getCcNumber()));
     $cc->addChild('cvv', htmlentities($payment->getCcCid()));
     $cc->addChild('expiryDate', htmlentities($date_expiry));
     $xml = $doc->asXML();
     // DEBUG
     if ($this->getDebug()) {
         $logger->info($xml);
     }
     // Send the data via HTTP POST and get the response
     $http = new Varien_Http_Adapter_Curl();
     $http->setConfig(array('timeout' => 30));
     $http->write(Zend_Http_Client::POST, $this->getGatewayUrl(), '1.1', array(), $xml);
     $response = $http->read();
     if ($http->getErrno()) {
         $http->close();
         $this->setError(array('message' => $http->getError()));
         return false;
     }
     // DEBUG
     if ($this->getDebug()) {
         $logger->info($response);
     }
     $http->close();
     // Strip out header tags
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     // Parse the XML object
     $xmlObj = simplexml_load_string($response);
     // Build an associative array with returned values
     $result = array();
     $result['Status'] = array();
     $result['Payment'] = array('TxnList' => array('Txn' => array()));
     $xpath = $xmlObj->xpath('/NABTransactMessage/Status/statusCode');
     $result['Status']['statusCode'] = $xpath !== false && isset($xpath[0]) ? (string) $xpath[0] : '';
     $xpath = $xmlObj->xpath('/NABTransactMessage/Status/statusDescription');
     $result['Status']['statusDescription'] = $xpath !== false && isset($xpath[0]) ? (string) $xpath[0] : '';
     $xpath = $xmlObj->xpath('/NABTransactMessage/Payment/TxnList/Txn/approved');
     $result['Payment']['TxnList']['Txn']['approved'] = $xpath !== false && isset($xpath[0]) ? (string) $xpath[0] : '';
     $xpath = $xmlObj->xpath('/NABTransactMessage/Payment/TxnList/Txn/responseCode');
     $result['Payment']['TxnList']['Txn']['responseCode'] = $xpath !== false && isset($xpath[0]) ? (string) $xpath[0] : '';
     $xpath = $xmlObj->xpath('/NABTransactMessage/Payment/TxnList/Txn/responseText');
     $result['Payment']['TxnList']['Txn']['responseText'] = $xpath !== false && isset($xpath[0]) ? (string) $xpath[0] : '';
     return $result;
 }
开发者ID:vincent-inspectionapps,项目名称:fontis_nab,代码行数:86,代码来源:Transact.php

示例10: postRequest

 public function postRequest(array $proArr)
 {
     $proArr = array_merge(array('PARTNER' => $this->getPartner(), 'USER' => $this->getApiUser(), 'VENDOR' => $this->getApiVendor(), 'PWD' => $this->getApiPassword(), 'TRXTYPE' => $this->getTrxtype(), 'REQUEST_ID' => $this->_generateRequestId()), $proArr);
     $proReq = '';
     foreach ($proArr as $k => $v) {
         //payflow gateway doesn't allow urlencoding.
         //$proReq .= '&'.$k.'='.urlencode($v);
         $proReq .= '&' . $k . '=' . $v;
     }
     $proReq = substr($proReq, 1);
     if ($this->getDebug()) {
         $debug = Mage::getModel('paypaluk/api_debug')->setRequestBody($proReq)->save();
     }
     $http = new Varien_Http_Adapter_Curl();
     $config = array('timeout' => 30);
     $http->setConfig($config);
     $http->write(Zend_Http_Client::POST, $this->getApiUrl(), '1.1', array(), $proReq);
     $response = $http->read();
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     if ($this->getDebug()) {
         $debug->setResponseBody($response)->save();
     }
     if ($http->getErrno()) {
         $http->close();
         $this->setError(array('type' => 'CURL', 'code' => $http->getErrno(), 'message' => $http->getError()));
         $this->setRedirectUrl($this->getApiErrorUrl());
         return false;
     }
     $http->close();
     $result = Mage::getModel('paypaluk/api_result');
     $valArray = $this->deformatNVP($response);
     foreach ($valArray as $k => $v) {
         $result->setData(strtolower($k), $v);
     }
     $result->setResultCode($result->getResult())->setRespmsg($result->getRespmsg());
     /*
     $client = new Varien_Http_Client();
     $uri = $this->getApiUrl();
     $client->setUri($uri)
            ->setConfig(array(
                 'maxredirects'=>5,
                 'timeout'=>30,
             ))
         ->setMethod(Zend_Http_Client::POST)
         ->setParameterPost($proArr)
         ->setHeaders('X-VPS-VIT-CLIENT-CERTIFICATION-ID: 33baf5893fc2123d8b191d2d011b7fdc')
         ->setHeaders('X-VPS-Request-ID: ' . $this->_generateRequestId())
         ->setHeaders('X-VPS-CLIENT-TIMEOUT: ' . $this->_clientTimeout)
         ->setUrlEncodeBody(false);
     
     $result = Mage::getModel('paypaluk/api_result');
     
     try {
         $response = $client->request();
         $response = strstr($response->getBody(), 'RESULT');
         $valArray = explode('&', $response);
         foreach($valArray as $val) {
                 $valArray2 = explode('=', $val);
                 $result->setData(strtolower($valArray2[0]), $valArray2[1]);
         }
     
         $result->setResultCode($result->getResult())
                 ->setRespmsg($result->getRespmsg());
         if ($this->getDebug()) {
             $debug->setResponseBody($response)
                 ->save();
         }
     
     } catch (Exception $e) {
         $result->setResultCode(-1)
                 ->setRespmsg($e->getMessage());
     }
     */
     return $result;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:76,代码来源:Pro.php

示例11: makeHttpPostRequest

 /**
  * Send a HTTP Post request
  *
  * @param string $url
  * @param array $data = array
  * @return false|string
  */
 public function makeHttpPostRequest($url, array $data = array())
 {
     if (!$this->hasValidCurlMethods()) {
         return $this->_makeLegacyHttpPostRequest($url, $data);
     }
     $curl = new Varien_Http_Adapter_Curl();
     $curl->setConfig(array('verifypeer' => strpos($url, 'https://') !== false, 'header' => true, 'timeout' => 15, 'referrer' => Mage::helper('wordpress')->getBaseUrl('wp-login.php')));
     $curl->addOption(CURLOPT_FOLLOWLOCATION, false);
     $curl->addOption(CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
     $curl->write(Zend_Http_Client::POST, $url, '1.1', array(), $data);
     $response = $curl->read();
     if ($curl->getErrno() || $curl->getError()) {
         throw new Exception(Mage::helper('wordpress')->__('CURL (%s): %s', $curl->getErrno(), $curl->getError()));
     }
     $curl->close();
     return $response;
 }
开发者ID:LiamMcArthur,项目名称:extension-fishpig-wordpress-integration,代码行数:24,代码来源:System.php

示例12: call

 /**
  * Send parameters to eWay gateway.
  *
  * @param string $xml
  * @param string $url
  * @return array|false
  */
 protected function call($xml, $url)
 {
     $http = new Varien_Http_Adapter_Curl();
     $config = array('timeout' => Fontis_EwayAu_Helper_Data::DEFAULT_TIMEOUT);
     $http->setConfig($config);
     $http->write(Zend_Http_Client::POST, $url, Zend_Http_Client::HTTP_1, array(), $xml);
     $response = $http->read();
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     if ($http->getErrno()) {
         $http->close();
         $this->setError(array('message' => $http->getErrno() . ' - ' . $http->getError()));
         return false;
     }
     $http->close();
     if (($parsedResArr = $this->parseXmlResponse($response)) === false) {
         $this->setError(array('message' => 'Invalid response from gateway.'));
         return false;
     }
     if ($parsedResArr['ewayTrxnStatus'] == 'True') {
         $this->unsError();
         return $parsedResArr;
     }
     if (isset($parsedResArr['ewayTrxnError'])) {
         $this->setError(array('message' => $parsedResArr['ewayTrxnError']));
     }
     return false;
 }
开发者ID:netzkollektiv,项目名称:fontis_ewayau,代码行数:35,代码来源:Direct.php

示例13: processIpnRequest

 /**
  * Get ipn data, send verification to PayPal, run corresponding handler
  */
 public function processIpnRequest()
 {
     if (!$this->_ipnFormData) {
         return;
     }
     $sReq = '';
     foreach ($this->_ipnFormData as $k => $v) {
         $sReq .= '&' . $k . '=' . urlencode(stripslashes($v));
     }
     // append ipn command
     $sReq .= "&cmd=_notify-validate";
     $sReq = substr($sReq, 1);
     $url = rtrim(Mage::helper('enterprise_pbridge')->getBridgeBaseUrl(), '/') . '/ipn.php?action=PaypalIpn';
     try {
         $http = new Varien_Http_Adapter_Curl();
         $http->write(Zend_Http_Client::POST, $url, '1.1', array(), $sReq);
         $response = $http->read();
     } catch (Exception $e) {
         throw $e;
     }
     if ($error = $http->getError()) {
         $this->_notifyAdmin(Mage::helper('enterprise_pbridge')->__('IPN postback HTTP error: %s', $error));
         return;
     }
     if (false !== preg_match('~VERIFIED~si', $response)) {
         $this->processIpnVerified();
     } else {
         // TODO: possible PCI compliance issue - the $sReq may contain data that is supposed to be encrypted
         $this->_notifyAdmin(Mage::helper('enterprise_pbridge')->__('IPN postback Validation error: %s', $sReq));
     }
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:34,代码来源:Ipn.php

示例14: initialize

 /**
  *
  * @param mixed                    $apiCallResult
  * @param Varien_Http_Adapter_Curl $apiService
  */
 public function initialize($apiCallResult, Varien_Http_Adapter_Curl $apiService)
 {
     $this->_result = $apiCallResult;
     $this->_error = $apiService->getError();
     $this->_httpStatus = $apiService->getInfo(CURLINFO_HTTP_CODE);
 }
开发者ID:Keesromkes,项目名称:magentoStylaConnect,代码行数:11,代码来源:Abstract.php

示例15: call

 /**
  * Send params to gateway
  *
  * @param string $xml
  * @return bool | array
  */
 public function call($xml)
 {
     if ($this->getDebug()) {
         $debug = AO::getModel('eway/api_debug')->setRequestBody($xml)->save();
     }
     $http = new Varien_Http_Adapter_Curl();
     $config = array('timeout' => 30);
     $http->setConfig($config);
     $http->write(Zend_Http_Client::POST, $this->getApiGatewayUrl(), '1.1', array(), $xml);
     $response = $http->read();
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     if ($this->getDebug()) {
         $debug->setResponseBody($response)->save();
     }
     if ($http->getErrno()) {
         $http->close();
         $this->setError(array('message' => $http->getError()));
         return false;
     }
     $http->close();
     $parsedResArr = $this->parseXmlResponse($response);
     if ($parsedResArr['ewayTrxnStatus'] == 'True') {
         $this->unsError();
         return $parsedResArr;
     }
     if (isset($parsedResArr['ewayTrxnError'])) {
         $this->setError(array('message' => $parsedResArr['ewayTrxnError']));
     }
     return false;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:37,代码来源:Direct.php


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