File: /var/www/html/sarvodayahospital/public/services/behealthy/online-doctor-consultation/processing.php
<?php
include('send-mail.php');
if(!empty($_POST))
{
// echo ('<pre>');
// print_r($_POST);exit;
$pagename = isset($_POST['pagename']) ? $_POST['pagename'] : '';
$name = isset($_POST['name']) ? $_POST['name'] : '' ;
$mobile = isset($_POST['phone']) ? $_POST['phone'] : '' ;
$email = isset($_POST['email']) ? $_POST['email'] : '' ;
$message = isset($_POST['message']) ? $_POST['message'] : '' ;
sendMail($pagename,$name,$mobile,$email,$message);
sendUserMail($email,$name);
// API CRM Integration Start
$CenterName = "Grnow";
$source = "Landing Page";
$location = "Delhi-NCR";
$postdata = '[
{
"Attribute": "FirstName",
"Value": "'.$name.'"
},
{
"Attribute": "Source",
"Value": "'.$source.'"
},
{
"Attribute": "Phone",
"Value": "'.$mobile.'"
},
{
"Attribute": "Email",
"Value": "'.$email.'"
},
{
"Attribute": "mx_Department",
"Value": "'.$pagename.'"
},
{
"Attribute": "SearchBy",
"Value": "Phone"
},
{
"Attribute": "mx_Location",
"Value": "'.$location.'"
},
{
"Attribute": "Notes",
"Value": "'.$message.'"
},
{
"Attribute": "mx_Center_Name",
"Value": "'.$CenterName.'"
},
{
"Attribute": "mx_Sub_Source1",
"Value": "'.$source.'"
}
]';
if($postdata)
{
// $data = json_encode($postdata);
// print_r($postdata);die;
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api-in21.leadsquared.com/v2/LeadManagement.svc/Lead.Capture?accesskey=u%24rd1ee5420d38698d2bcbba763efc36146&secretkey=dd27a1402a82e9e2ffd239b8a815a4f47e9ac1a7&LeadUpdateBehavior=DoNotUpdate',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $postdata,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
),
));
$response = curl_exec($curl);
$responseArray = json_decode($response,true);
$postdataArray = json_decode($postdata,true);
curl_close($curl);
$responseRt = array();
$responseRt['response'] = $responseArray;
$responseRt['payload'] = $postdataArray;
$responseRtjson = json_encode($responseRt);
echo $responseRtjson;die;
}
// API CRM Integration End
}