| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2c.hellogtx.com/application/modules/cms/controllers/ |
Upload File : |
<?php
class Cms_EnqirenowController extends Zend_Controller_Action
{
public $baseUrl = '';
protected $objMdl;
public $smtpUserName;
public $smtpPassword;
public $smtpPort;
public $smtpHost;
public $AgencyId;
public $tablenamePage;
protected $db;
public function init()
{
$this->objMdl = new Admin_Model_CRUD();
$object = Zend_Controller_Front::getInstance();
$this->action = $action = $object->getRequest()->getActionName();
$this->modulename = $modulename = $object->getRequest()->getModuleName();
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrap = $aConfig['bootstrap'];
$this->view->stylecss = $this->stylecss = $BootStrap['stylecss'];
$this->siteName = $BootStrap['siteName'];
$this->baseUrl = $BootStrap['siteUrl'];
$this->gtxBtoBsite = $BootStrap['gtxBtoBsite'];
$this->AgencyId = $BootStrap['gtxagencysysid'];
$this->AgentSysId = $BootStrap['gtxagentsysid'];
$this->LeadURL = $BootStrap['siteUrl'] . 'index/query';
$this->tablename = 'tbl_enquiry';
$this->tablenamePage = 'tbl_static_pages';
$this->adminEmail = $BootStrap['adminEmail'];
$this->objHelperGeneral = $this->_helper->General;
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function indexAction()
{
$this->_helper->layout()->disableLayout('');
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getParams();
if ($_POST) {
if ($_POST['leadsend'] == 0 && $_POST['leadID'] == '') {
try {
$_POST['Noofdays'] = (int)$_POST['Noofdays'];
$apiData = [
'AgencySysId' => (int) ($this->AgencyId),
'AgentSysId' => (int) ($this->AgentSysId),
'leadsend' => (int) ($_POST['leadsend']),
'PlanType' => 0,
'leadID' => (int) ($_POST['leadID']),
'Email' => trim($_POST['email']),
'countrycode' => trim($_POST['countrycode']),
'MobileNumber' => (int)($_POST['mobile']),
'FirstName' => trim($_POST['fname']),
'LastName' => trim($_POST['lname']),
'traveldate' => trim($_POST['traveldate']),
'salution' => trim($_POST['salutation']),
];
// $curl = curl_init($this->gtxBtoBsite . "gtxwebservices/lead"); // b2c site url
// curl_setopt($curl, CURLOPT_POST, true);
// curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
// curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
// $response = curl_exec($curl);
// echo "<pre>";print_r($apiData);die;
// curl_close($curl);
$model = new Gtxwebservices_Model_Webservices();
//$response = $model->sendLead($apiData);
$responseArr = json_decode($response, 1);
// echo "<pre>";print_r($responseArr);die('query');
if ($responseArr['status'] == 'success') {
echo json_encode(array('status' => true, 'message'=>'', 'queryType' => 'lead', 'leadID' => $responseArr['leadID'], 'BookingType' => $responseArr['BookingType'], 'PkgType' => $responseArr['PkgType'], 'DestinationValue' => $responseArr['DestinationValue'], 'DestinationId' => $responseArr['DestinationId'], 'byopacktypeCat' => $responseArr['byopacktypeCat'], 'noofday' => $responseArr['noofday']));
} else {
echo json_encode(array('status' => false, 'message'=>$response, 'queryType' => 'lead'));exit;
}
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
}else {
try {
$_POST['Noofdays'] = trim($_POST['Noofdays']);
$apiData = [
'AgencySysId' => (int) ($this->AgencyId),
'AgentSysId' => (int) ($this->AgentSysId),
'leadsend' => (int) ($_POST['leadsend']),
'PlanType' => 0,
'leadID' => (int) ($_POST['leadID']),
'Email' => trim($_POST['email']),
'countrycode' => trim($_POST['countrycode']),
'MobileNumber' => (int)($_POST['mobile']),
'FirstName' => trim($_POST['fname']),
'LastName' => trim($_POST['lname']),
'traveldate' => trim($_POST['traveldate']),
'salution' => trim($_POST['salutation']),
'salution' => trim($_POST['salutation']),
'NoofTraveler' => (int)($_POST['adultTwinSharing'])+(int)($_POST['adultTripleSharing'])+(int)($_POST['adultSingleSharing'])+(int)($_POST['childSharing']),
'message' => 'Will Book - '. trim($_POST['willbookdays']).', Preferred Hotel Category - '.trim($_POST['hotelcategory'][0]).' '.trim($_POST['hotelcategory'][1]).' '.trim($_POST['hotelcategory'][2]).' '.trim($_POST['hotelcategory'][3]).', Preferred time to call - '.trim($_POST['preferredtime']).', Type of tour - '.trim($_POST['tourtype']).', Additional requirements -'.trim($_POST['message']),
];
//echo "<pre>";print_r($apiData);die('query');
//$curl = curl_init($baseUrl."gtxwebservices/lending-page-query"); // b2c site url
// $curl = curl_init($this->gtxBtoBsite . "gtxwebservices/lead-update"); // b2c site url
// curl_setopt($curl, CURLOPT_POST, true);
// curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($apiData));
// curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
// $response = curl_exec($curl);
// echo "<pre>";print_r($response);die('query');
curl_close($curl);
$responseArr = json_decode($response, 1);
if ($responseArr['status'] == 'success') {
echo json_encode(array('status' => true, 'message'=>$response, 'queryType' => 'query','data'=>$responseArr));exit;
} else {
echo json_encode(array('status' => false, 'message'=>$response, 'queryType' => 'query','data'=>$responseArr));exit;
}
} catch (Exception $ex) {
echo $message = $ex->getMessage();
exit;
}
}
}
}
}