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


PHP Varien_Http_Client::setParameterPost方法代码示例

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


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

示例1: indexAction

 /**
  * run synchronize customer to Magestore
  */
 public function indexAction()
 {
     // Turn Off
     die('x');
     $session = Mage::getSingleton('core/session');
     $limit = $this->getRequest()->getParam('limit', 10);
     $start = (int) $session->getLastAccountId();
     // Customer info
     $customers = Mage::getResourceModel('customer/customer_collection');
     $customers->addFieldToFilter('entity_id', array('gt' => $start))->addAttributeToSelect('email')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('password_hash')->getSelect()->limit($limit)->order('entity_id ASC');
     if (!$customers->count()) {
         echo '0';
         return;
     }
     $customerData = array();
     foreach ($customers as $customer) {
         $customerData[] = array('email' => $customer->getEmail(), 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'password_hash' => $customer->getPasswordHash());
         $start = $customer->getId();
     }
     // Run query
     $url = Mage::getStoreConfig('subsystem/general/account') . 'add';
     $client = new Varien_Http_Client($url);
     $client->setParameterPost('pk', Magestore_Subsystem_Model_Observer::PK);
     $client->setParameterPost('data', Zend_Json::encode($customerData));
     $response = $client->request(Varien_Http_Client::POST);
     // Update start to session
     $session->setLastAccountId($start);
     echo $start;
     echo '<br>' . $response->getBody();
 }
开发者ID:Thinlt,项目名称:simicart,代码行数:33,代码来源:IndexController.php

示例2: queryMaxMind

 function queryMaxMind($params)
 {
     $servers = array("http://minfraud1.maxmind.com", "http://minfraud2.maxmind.com");
     $return = array();
     $error = false;
     foreach ($servers as $server) {
         $http = new Varien_Http_Client($server . "/app/ccv2r");
         $http->setParameterPost($params);
         try {
             $response = $http->request('POST');
         } catch (Exception $e) {
             continue;
         }
         if ($response->getStatus() != '200') {
             continue;
         }
         foreach (explode(";", $response->getBody()) as $keyval) {
             $bits = explode("=", $keyval);
             if (count($bits) > 1) {
                 list($key, $value) = $bits;
                 $return[$key] = $value;
             }
         }
         if (!empty($return)) {
             break;
         }
     }
     if (empty($return)) {
         $return['errmsg'] = "Could not contact MaxMind servers.";
         $return['err'] = "FATAL_ERROR";
     }
     return $return;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:33,代码来源:Data.php

示例3: request

 /**
  * @param array $data Array of each installed Fontis extensions version
  * @return string
  * @throws Exception
  */
 public function request($data)
 {
     $client = new Varien_Http_Client(Mage::helper('fontis_info')->getInfoUrl(), array('keepalive' => true));
     $client->setParameterPost('data', $data);
     // If we accept gzip encoding and the response isn't actually chunked, Zend_Http_Response will throw
     // an exception. Unfortunately, this means we can't use gzip encoded responses at this time.
     $client->setHeaders('Accept-encoding', 'identity');
     $response = $client->request(Varien_Http_Client::POST);
     if ($response->isError()) {
         // if the request fails, throw an exception
         throw new Exception('Error getting info data: ' . $response->getStatus() . ' ' . $response->getMessage());
     }
     return $response->getBody();
 }
开发者ID:vstorm83,项目名称:ausport,代码行数:19,代码来源:Info.php

示例4: processPaymentRequest

 /**
  * Exchange token for payment id (third step of Authrature)
  *
  * 
  * @return string (encoded json)
  */
 public function processPaymentRequest(array $data)
 {
     //start variables preparation
     $client_id = Mage::helper('sign2pay')->getSign2payClientId();
     $client_secret = Mage::helper('sign2pay')->getSign2payClientSecret();
     $quote = Mage::getSingleton('checkout/session')->getQuote();
     $amount = $quote['grand_total'] * 100;
     $ref_id = Mage::getSingleton('checkout/session')->getSign2PayCheckoutHash();
     $request_body = array('client_id' => $client_id, 'amount' => $amount, 'ref_id' => $ref_id, 'token' => $data['access_token']['token']);
     //end variables preparation
     /*==========================================start request preparation==========================*/
     $client = new Varien_Http_Client('https://app.sign2pay.com/api/v2/payment/authorize/capture');
     $client->setMethod(Varien_Http_Client::POST);
     $client->setAuth($client_id, $client_secret);
     $client->setParameterPost($request_body);
     try {
         $response = $client->request();
         return $response->getBody();
     } catch (Zend_Http_Client_Exception $e) {
         Mage::logException($e);
     }
 }
开发者ID:ArjenMiedema,项目名称:magento-sign2pay,代码行数:28,代码来源:Processor.php

示例5: catch

/**
 * Listrak Remarketing Magento Extension Ver. 1.1.9
 *
 * PHP version 5
 *
 * @category  Listrak
 * @package   Listrak_Remarketing
 * @author    Listrak Magento Team <magento@listrak.com>
 * @copyright 2014 Listrak Inc
 * @license   http://s1.listrakbi.com/licenses/magento.txt License For Customer Use of Listrak Software
 * @link      http://www.listrak.com
 */
$installer = $this;
$installer->startSetup();
$installer->run("\nALTER TABLE {$this->getTable('listrak/session')}\n  ADD COLUMN `converted` boolean NOT NULL DEFAULT 0;\n");
try {
    Mage::getModel("listrak/log")->addMessage("1.1.8-1.1.9 upgrade");
} catch (Exception $e) {
}
try {
    $client = new Varien_Http_Client("http://magento.listrakbi.com/Install.ashx");
    $client->setMethod(Varien_Http_Client::POST);
    $client->setParameterPost("Listrak Extension Version", "1.1.9");
    $client->setParameterPost("Magento Version", Mage::getVersion());
    $client->setParameterPost("Install URL", "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
    $client->setParameterPost("IP Address", "{$_SERVER['SERVER_ADDR']}");
    $client->request();
} catch (Exception $e) {
}
$installer->endSetup();
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:30,代码来源:mysql4-upgrade-1.1.8-1.1.9.php

示例6: _postRequest

 /**
  * Post request to gateway and return responce
  *
  * @param Mage_Paygate_Model_Authorizenet_Request $request)
  * @return Mage_Paygate_Model_Authorizenet_Result
  */
 protected function _postRequest(Varien_Object $request)
 {
     $debugData = array('request' => $request->getData());
     $result = Mage::getModel('paygate/authorizenet_result');
     $client = new Varien_Http_Client();
     $uri = $this->getConfigData('cgi_url');
     $client->setUri($uri ? $uri : self::CGI_URL);
     $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
     foreach ($request->getData() as $key => $value) {
         $request->setData($key, str_replace(self::RESPONSE_DELIM_CHAR, '', $value));
     }
     $request->setXDelimChar(self::RESPONSE_DELIM_CHAR);
     $client->setParameterPost($request->getData());
     $client->setMethod(Zend_Http_Client::POST);
     try {
         $response = $client->request();
     } catch (Exception $e) {
         $result->setResponseCode(-1)->setResponseReasonCode($e->getCode())->setResponseReasonText($e->getMessage());
         $debugData['result'] = $result->getData();
         $this->_debug($debugData);
         Mage::throwException($this->_wrapGatewayError($e->getMessage()));
     }
     $responseBody = $response->getBody();
     $r = explode(self::RESPONSE_DELIM_CHAR, $responseBody);
     if ($r) {
         $result->setResponseCode((int) str_replace('"', '', $r[0]))->setResponseSubcode((int) str_replace('"', '', $r[1]))->setResponseReasonCode((int) str_replace('"', '', $r[2]))->setResponseReasonText($r[3])->setApprovalCode($r[4])->setAvsResultCode($r[5])->setTransactionId($r[6])->setInvoiceNumber($r[7])->setDescription($r[8])->setAmount($r[9])->setMethod($r[10])->setTransactionType($r[11])->setCustomerId($r[12])->setMd5Hash($r[37])->setCardCodeResponseCode($r[38])->setCAVVResponseCode(isset($r[39]) ? $r[39] : null)->setSplitTenderId($r[52])->setAccNumber($r[50])->setCardType($r[51])->setRequestedAmount($r[53])->setBalanceOnCard($r[54]);
     } else {
         Mage::throwException(Mage::helper('paygate')->__('Error in payment gateway.'));
     }
     $debugData['result'] = $result->getData();
     $this->_debug($debugData);
     return $result;
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:39,代码来源:Authorizenet.php

示例7: _postRequest

 /**
  *  Send request to gateway
  *
  *  @param    Mage_Chronopay_Model_Gateway_Request
  *  @return	  mixed
  */
 protected function _postRequest(Mage_Chronopay_Model_Gateway_Request $request)
 {
     $result = Mage::getModel('chronopay/gateway_result');
     $client = new Varien_Http_Client();
     $url = $this->getConfigData('cgi_url');
     $client->setUri($url ? $url : self::CGI_URL);
     $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
     $client->setParameterPost($request->getData());
     $client->setMethod(Zend_Http_Client::POST);
     $debugData = array('request' => $request->getData());
     try {
         $response = $client->request();
         $body = $response->getRawBody();
         if (preg_match('/(T\\|(.+)\\|[\\r\\n]{0,}){0,1}(Y\\|(.+)?|\\|)|(N\\|(.+[\\r\\n]{0,}.+){0,})/', $body, $matches)) {
             $transactionId = $matches[2];
             $message = isset($matches[4]) ? trim($matches[4], '|') : '';
             if (isset($matches[5], $matches[6])) {
                 $result->setError($matches[6]);
                 Mage::throwException($matches[6]);
             }
             if ($message == 'Completed') {
                 $result->setTransaction($request->getTransaction());
             }
             if (strlen($transactionId)) {
                 $result->setTransaction($transactionId);
             }
             if (!$result->getTransaction()) {
                 Mage::throwException(Mage::helper('chronopay')->__('The transaction ID is invalid.'));
             }
         } else {
             Mage::throwException(Mage::helper('chronopay')->__('Invalid response format.'));
         }
     } catch (Exception $e) {
         $result->setResponseCode(-1)->setResponseReasonCode($e->getCode())->setResponseReasonText($e->getMessage());
         $exceptionMsg = Mage::helper('chronopay')->__('Gateway request error: %s', $e->getMessage());
         $debugData['result'] = $result->getData();
         $this->_debug($debugData);
         Mage::throwException($exceptionMsg);
     }
     $debugData['result'] = $result->getData();
     $this->_debug($debugData);
     return $result;
 }
开发者ID:jweiss,项目名称:Magento-Example,代码行数:49,代码来源:Gateway.php

示例8: _postRequest

 protected function _postRequest(Varien_Object $request)
 {
     $result = AO::getModel('paygate/authorizenet_result');
     $client = new Varien_Http_Client();
     $uri = $this->getConfigData('cgi_url');
     $client->setUri($uri ? $uri : self::CGI_URL);
     $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
     $client->setParameterPost($request->getData());
     $client->setMethod(Zend_Http_Client::POST);
     if ($this->getConfigData('debug')) {
         foreach ($request->getData() as $key => $value) {
             $requestData[] = strtoupper($key) . '=' . $value;
         }
         $requestData = join('&', $requestData);
         $debug = AO::getModel('paygate/authorizenet_debug')->setRequestBody($requestData)->setRequestSerialized(serialize($request->getData()))->setRequestDump(print_r($request->getData(), 1))->save();
     }
     try {
         $response = $client->request();
     } catch (Exception $e) {
         $result->setResponseCode(-1)->setResponseReasonCode($e->getCode())->setResponseReasonText($e->getMessage());
         if (!empty($debug)) {
             $debug->setResultSerialized(serialize($result->getData()))->setResultDump(print_r($result->getData(), 1))->save();
         }
         AO::throwException(AO::helper('paygate')->__('Gateway request error: %s', $e->getMessage()));
     }
     $responseBody = $response->getBody();
     $r = explode(self::RESPONSE_DELIM_CHAR, $responseBody);
     if ($r) {
         $result->setResponseCode((int) str_replace('"', '', $r[0]))->setResponseSubcode((int) str_replace('"', '', $r[1]))->setResponseReasonCode((int) str_replace('"', '', $r[2]))->setResponseReasonText($r[3])->setApprovalCode($r[4])->setAvsResultCode($r[5])->setTransactionId($r[6])->setInvoiceNumber($r[7])->setDescription($r[8])->setAmount($r[9])->setMethod($r[10])->setTransactionType($r[11])->setCustomerId($r[12])->setMd5Hash($r[37])->setCardCodeResponseCode($r[39]);
     } else {
         AO::throwException(AO::helper('paygate')->__('Error in payment gateway'));
     }
     if (!empty($debug)) {
         $debug->setResponseBody($responseBody)->setResultSerialized(serialize($result->getData()))->setResultDump(print_r($result->getData(), 1))->save();
     }
     return $result;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:37,代码来源:Authorizenet.php

示例9: request

 /**
  * Send the HTTP request and return an HTTP response object
  *
  * @param string $url
  * @param Varien_Object $data
  * @param string $method
  * @return Varien_Object
  */
 public function request($url, Varien_Object $data, $method = 'GET')
 {
     $client = new Varien_Http_Client($url, array('timeout' => 30));
     $client->setMethod($method);
     if ($method == Zend_Http_Client::POST) {
         $client->setParameterPost($this->_parseArray($data));
     } else {
         $client->setParameterGet($this->_parseArray($data));
     }
     $response = $client->request();
     $body = json_decode($response->getBody(), true);
     $result = $this->_parseObject($body);
     return $result;
 }
开发者ID:Hospeed,项目名称:pagarme-magento,代码行数:22,代码来源:Api.php

示例10: rpxCall

 private function rpxCall($url, $method = 'GET', $postParams = null)
 {
     $result = "rpxCallUrl: no result yet";
     try {
         $http = new Varien_Http_Client($url);
         $http->setHeaders(array("Accept-encoding" => "identity"));
         if ($method == 'POST') {
             $http->setParameterPost($postParams);
         }
         $response = $http->request($method);
         $body = $response->getBody();
         try {
             $result = json_decode($body);
         } catch (Exception $e) {
             throw Mage::exception('Mage_Core', $e);
         }
         if ($result) {
             return $result;
         } else {
             throw Mage::exception('Mage_Core', "something went wrong");
         }
     } catch (Exception $e) {
         throw Mage::exception('Mage_Core', $e);
     }
 }
开发者ID:rjocoleman,项目名称:janrain-magento-plugin,代码行数:25,代码来源:Rpxcall.php

示例11: ping

 public function ping()
 {
     // Get current version of the extension
     $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
     $table = Mage::getSingleton('core/resource')->getTableName('core_resource');
     $stmt = $connection->query("SELECT version FROM {$table} WHERE code='anattadesign_awesomecheckout_setup';");
     $data = $stmt->fetch();
     $version = $data['version'];
     $ping = array('version' => $version, 'site_name' => Mage::getStoreConfig('general/store_information/name'), 'url' => 'http://' . str_replace(array('http://', 'https://', '/index.php/', '/index.php'), '', Mage::getUrl()));
     $ping['url'] = $this->trailingslashit($ping['url']);
     // make call
     $client = new Varien_Http_Client('http://api.anattadesign.com/awesomecheckout/1alpha/collect/ping');
     $client->setMethod(Varien_Http_Client::POST);
     $client->setParameterPost('ping', $ping);
     try {
         $response = $client->request();
         if ($response->isSuccessful()) {
             $json_response = json_decode($response->getBody(), true);
             $ping_success = $json_response['status'] == 'success' ? true : false;
         }
     } catch (Exception $e) {
         $ping_success = false;
     }
     if ($ping_success) {
         // make sure ping is not rescheduled anymore
         Mage::getModel('core/config')->deleteConfig('anattadesign_awesomecheckout_ping_rescheduled');
     } else {
         // reschedule ping, increment counts if its already scheduled, so that we can see how many times it has failed
         // $ping_rescheduled = Mage::getStoreConfig( 'anattadesign_awesomecheckout_ping_rescheduled' );
         // Fetch directly from database to bypass Magento config cache.
         // Its better to bypass cache and make a sql query in favor of performance, sql query is not gonna run up on frontend side, except when all the cache is refreshed & extension is upgraded
         $table = Mage::getSingleton('core/resource')->getTableName('core_config_data');
         $stmt = $connection->query("SELECT value FROM {$table} WHERE path='anattadesign_awesomecheckout_ping_rescheduled' AND scope = 'default' AND scope_id = 0 LIMIT 1;");
         $data = $stmt->fetch();
         if ($data === false) {
             $ping_rescheduled = 1;
         } else {
             $ping_rescheduled = intval($data['value']) + 1;
         }
         Mage::getModel('core/config')->saveConfig('anattadesign_awesomecheckout_ping_rescheduled', $ping_rescheduled);
     }
 }
开发者ID:anattadesign,项目名称:AwesomeCheckout,代码行数:42,代码来源:Data.php

示例12: customerSaveAfter

 public function customerSaveAfter($observer)
 {
     if (!Mage::getStoreConfig('subsystem/general/enable')) {
         return;
     }
     $customer = $observer['customer'];
     if ($customer->getData('magestore_changed')) {
         return;
     }
     if (!$customer->isObjectNew() && $customer->getOrigData('email') == $customer->getData('email') && $customer->getOrigData('firstname') == $customer->getData('firstname') && $customer->getOrigData('lastname') == $customer->getData('lastname') && $customer->getOrigData('password_hash') == $customer->getData('password_hash')) {
         return;
     }
     try {
         $url = Mage::getStoreConfig('subsystem/general/account') . 'update';
         $client = new Varien_Http_Client($url);
         $client->setParameterPost('pk', self::PK);
         // Update source
         $source = Mage::getBaseUrl();
         $client->setParameterPost('source', substr($source, 7));
         // Original email
         $email = $customer->getOrigData('email') ? $customer->getOrigData('email') : $customer->getEmail();
         $client->setParameterPost('email', $email);
         // customerData
         $customerData = Zend_Json::encode(array('email' => $customer->getEmail(), 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'password_hash' => $customer->getPasswordHash()));
         $client->setParameterPost('customerData', $customerData);
         $client->request(Varien_Http_Client::POST);
     } catch (Exception $e) {
     }
 }
开发者ID:Thinlt,项目名称:simicart,代码行数:29,代码来源:Observer.php

示例13: _postRequest

 /**
  * Post the transaction request
  *
  * @param	Shift4_Shift4Payment_Model_ApiRequest $request
  * @return	Shift4_Shift4Payment_Model_ApiResponse
  */
 protected function _postRequest(Shift4_Shift4Payment_Model_ApiRequest $request)
 {
     $client = new Varien_Http_Client();
     $client->setUri($request->getData('url'));
     $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
     $params = array_merge(array('STX' => 'YES'), $request->getData(), array('ETX' => 'YES'));
     $client->setParameterPost($params);
     $client->setMethod(Zend_Http_Client::POST);
     try {
         $response = $client->request();
     } catch (Exception $e) {
         $response = Mage::getModel('shift4payment/ApiResponse');
         $response->setResponseCode(self::RESPONSE_ERROR);
         $response->setResponseMessage('There was a problem communicating with the payment gateway. Please try again.');
     }
     $request->setParams($params);
     return $this->_processResponse($request, $response->getBody());
 }
开发者ID:xiaoguizhidao,项目名称:tyler-live,代码行数:24,代码来源:PaymentMethod.php


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