<?php


 // init and get token


	$curl = curl_init();

	curl_setopt_array($curl, array(
	  CURLOPT_URL => 'https://login.salesforce.com/services/oauth2/token',
	  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 => 'grant_type=password&client_id=3MVG9YDQS5WtC11oBAWq.mmfQwyxzp2fQ5sJoh0FylT65SJeo6BczzwT_JXh4oRsMUAaXhqJ.4.Bvf9ykkKFZ&client_secret=8576256114121081226&username=rajasekhar%40zestmoney.in&password=zmsf%40123',
	  CURLOPT_HTTPHEADER => array(
		'Content-Type: application/x-www-form-urlencoded',
		'Cookie: BrowserId=_azVOTIfEeyRyy_TUSvMNQ; CookieConsentPolicy=0:0; LSKey-c$CookieConsentPolicy=0:0; BrowserId=sHZo6Yl9EeysUbFVaCYNsQ; CookieConsentPolicy=0:0; LSKey-c$CookieConsentPolicy=0:0'
	  ),
	));

	$response = curl_exec($curl);

	curl_close($curl);
	 
	  $responseArray = json_decode($response,TRUE);
	  
	 $access_token =  $responseArray['access_token'];
		
	
	 
		
	//  create activity - update	
		
		$curl = curl_init();

	 curl_setopt_array($curl, array(
	  CURLOPT_URL => 'https://zestmoney.my.salesforce.com/services/apexrest/CreateActivity/',
	  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 =>'{
	"loanId":"LoanTest",
	"phone":"9907011534",
	"subject":"TestActivity_Subject_3",
	"attemptType":"Tellecalling" ,
	"attemptStatus":"Contact P (Telecalling)",
	"disposition":"FPTP (Telecalling)",
	"subdisposition1":"Expecting Salary",
	"subdisposition2":"",
	"remark":"working on it",
	"popupdate":"2021-09-13T00:00:00.000Z",
	"amount":"100",
	"modeofpayment":"",
	"status":"Completed"
	}',
	  CURLOPT_HTTPHEADER => array(
		'Authorization: Bearer '.$access_token.'',
		'Content-Type: text/plain',
		'Cookie: BrowserId=_azVOTIfEeyRyy_TUSvMNQ; CookieConsentPolicy=0:1; LSKey-c$CookieConsentPolicy=0:1; BrowserId=sHZo6Yl9EeysUbFVaCYNsQ'
	  ),
	));

	$response = curl_exec($curl);

	curl_close($curl);
	echo $response;
	
	
	
	
	
	

?>