public function sendRequest($email = NULL, $cultureCode = NULL, $firstname = NULL, $lastname = NULL, $IDcategoria = NULL, $phone = NULL, $address = NULL, $nation = NULL, $reqUrlReg = NULL, $denominazione = NULL, $referer = NULL) { $url = COM_BOOKINGFORCONNECTOR_NLP_URL; $body = array(); $querysuffix = ""; $sendpost = false; switch (COM_BOOKINGFORCONNECTOR_NLP_SYSTEM) { case "mailup": $sendpost = true; $body = array('email' => $email, 'campo1' => $firstname, 'campo2' => $lastname); if (defined('COM_BOOKINGFORCONNECTOR_NLP_OTHERPARAM_' . strtoupper(substr($cultureCode, 0, 2)))) { try { $querysuffix = constant('COM_BOOKINGFORCONNECTOR_NLP_OTHERPARAM_' . strtoupper(substr($cultureCode, 0, 2))); } catch (Exception $e) { } } elseif (defined('COM_BOOKINGFORCONNECTOR_NLP_OTHERPARAM')) { $querysuffix = COM_BOOKINGFORCONNECTOR_NLP_OTHERPARAM; } break; case "newsletterplus": $languareResponse = self::getLanguage($cultureCode); if ($IDcategoria == null && defined('COM_BOOKINGFORCONNECTOR_NLP_CAT_' . strtoupper(substr($cultureCode, 0, 2)))) { try { $IDcategoria = constant('COM_BOOKINGFORCONNECTOR_NLP_CAT_' . strtoupper(substr($cultureCode, 0, 2))); } catch (Exception $e) { } } $body = array('IDcliente' => COM_BOOKINGFORCONNECTOR_NLP_ID, 'IDcategoria' => $IDcategoria, 'cognome' => $lastname, 'nome' => $firstname, 'codice' => $cultureCode, 'denominazione' => $denominazione, 'tel' => $phone, 'indirizzo' => $address, 'email' => $email, 'IDstato' => $nation, 'reqUrlReg' => $reqUrlReg, 'lingua' => $languareResponse); //$url = $this->helper->getQuery($options); break; } $body = wsQueryHelper::sanitizeData($body); $query = http_build_query($body); // http_build_query has urlencoded the query and char '$' has been replaced by '%24'. This restores the '$' char $query = str_ireplace('%24', '$', $query); $query = str_ireplace('%27', '\'', $query); $query = str_ireplace('__27__', '\'\'', $query); $query = str_ireplace('__1013__', '%0D%0A', $query); // $query = http_build_query($body); $query .= $querysuffix; // $r = $query; $r = null; try { $ch = curl_init($url); // curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888'); /*-------fiddler------*/ curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_POST, $sendpost); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_POSTFIELDS, $query); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $r = curl_exec($ch); curl_close($ch); } catch (Exception $e) { //echo 'Caught exception: ', $e->getMessage(), "\n"; } return $r; }
<?php /** * @package Bookingforconnector * @copyright Copyright (c)2006-2016 Ipertrade * @license GNU General Public License version 3, or later */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $pathbase = JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_bookingforconnector' . DIRECTORY_SEPARATOR; require_once $pathbase . 'defines.php'; require_once $pathbase . 'helpers/BFCHelper.php'; require_once $pathbase . 'helpers/wsQueryHelper.php'; $wsHelper = new wsQueryHelper(COM_BOOKINGFORCONNECTOR_WSURL, COM_BOOKINGFORCONNECTOR_APIKEY); $checkUrl = $wsHelper->url_exists(); $result = null; $resultOk = false; $msg = ""; if ($checkUrl) { $options = array('path' => '/Checkstatus', 'data' => array('$format' => 'json')); $url = $wsHelper->getQuery($options); //$r = $this->helper->executeQuery($url); $r = $wsHelper->executeQuery($url); if (isset($r)) { $res = json_decode($r); //echo "<pre>"; //echo print_r($res); //echo "</pre>"; // if (!empty($res->d->results)) { $result = $res->d->results;
public function getUrl() { $bankUrl = ''; $data = 'id=' . $this->merchantNumber . '&password='******'&action=' . $this->action . '&amt=' . number_format($this->amt, 2, '.', '') . '¤cycode=' . $this->currencycode . '&langid=' . $this->langid . '&responseurl=' . $this->responseUrl . '&errorurl=' . $this->errorUrl . '&trackid=' . $this->trackid . '&udf1=' . $this->udf1 . '&udf4=' . $this->udf4; $this->dataSend = $this->paymentUrl . "?" . $data; $buffer = wsQueryHelper::executeQuery($this->dataSend, "POST", false); $token = explode(":", $buffer, 2); $tid = $token[0]; $paymenturl = $token[1]; $bankUrl = $paymenturl . "?PaymentID=" . $tid; /*salvo i dati inviati alla banca e cosa mi ritorna la banca come url di invio*/ $this->donation = $donation; if (!$this->isdonation) { if (isset($this->suffixOrder) && $this->suffixOrder != "") { BFCHelper::setOrderStatus($this->orderId, null, false, false, $data . '&bankUrl=' . $bankUrl . '&paymentUrl=' . $this->paymentUrl); } else { BFCHelper::setOrderStatus($this->orderId, 1, false, false, $data . '&bankUrl=' . $bankUrl . '&paymentUrl=' . $this->paymentUrl); } } return $bankUrl; }