hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
home
/
ubuntu
/
bmse.net
/
Upload FileeE
HOME
<?php ini_set("display_errors",1); include('includes/application_includes.php'); //echo "tags here"; #zoho lead search starts here $tokenData = "refresh_token=".$refresh_token."&client_id=".$client_id."&client_secret=".$client_secret."&grant_type=refresh_token"; #getting access token $getTokendata = callAPIP('POST', 'https://accounts.zoho.com/oauth/v2/token?', ($tokenData)); $tokenResponse = json_decode($getTokendata, true); //echo "first"; //ArrayDisplay($tokenResponse); # getting performer records from db to assign tags /* $rows = $db->getRows('SELECT `id`, `itempkid` , `zoho_tags`, `itemtype` , `email`, `company` FROM `bmse_zoho_records` WHERE `status`="update" and `zoho_tags`!=" " and `insert_dttm` < now() - interval 5 minute order by `id` DESC');*/ $rows = $db->getRows('SELECT `id`, `itempkid` , `zoho_tags`, `itemtype` , `email`, `company` FROM `bmse_zoho_records` WHERE `id` not in (6871, 2294,2295, 8437, 6873,6874,6875,6876,8050,8051,8437) and `expo_id` in (532,538,558,539,543,540,542,544,561,545,547) and `itemtype`="ticket"'); ArrayDisplay($rows); $sponsorrow = 0; $speakerrow = 0; $exhibitorrow = 0; $ticketrow=0; if (!empty($rows)) { $tag=''; $data['Event_Booth_Purchases']=''; $data['Event_Ticket_Purchased']=''; $searchResponse['data']=''; foreach ($rows as $row) { if($row['itemtype']=='ticket'){ #case4 - ticket //$string = "Raleigh24"; $string = $row['zoho_tags']; $expo = $numbers = array(); if(preg_match_all('/([a-z ]+[0-9]+)/i', $string, $mt)) { $nrmt = count($mt[0]); for($i=0; $i<$nrmt; $i++) { if(preg_match('/([a-z ]+)([0-9]+)/i', $mt[0][$i], $mt2)) { $expo[$i] = trim($mt2[1]); $numbers[$i] = $mt2[2]; } } } //echo $expo[0]; $compa = urlencode($row['email']); $itempkid=$compa; $searchRecord = callAPI('GET', 'https://www.zohoapis.com/crm/v2/Contacts/search?criteria=(Email:equals:'.$itempkid.')', '', $tokenResponse['access_token']); $searchResponse = json_decode($searchRecord, true); echo 'Search Response."<br/>"'; ArrayDisplay($searchResponse); if (!empty($searchResponse['data'])) { $eventInt = ''; $eventIntu=''; foreach($searchResponse['data'] as $data) { if (!empty($data['Event_Ticket_Purchased'])) { $record_idSports = array_push($data['Event_Ticket_Purchased'], $row['zoho_tags']); } else { $data['Event_Ticket_Purchased']=array($row['zoho_tags']); } if ($data['id']) { $eventIntu = array_unique($data['Event_Ticket_Purchased']); $eventInt = implode(',',$eventIntu); $dataArray = array( "data" => array( array( "id" => $data['id'], "Event_Ticket_Purchased" => $data['Event_Ticket_Purchased'], //"Attendee" => "YES", "Attendee" => "Attended", "Event_Interested_In" => $eventInt )), "trigger" =>array( "approval" ) ); $updateRecord = callAPI('PUT', 'https://www.zohoapis.com/crm/v2/Contacts/'.$data['id'].'', json_encode($dataArray), $tokenResponse['access_token']); $updateRecordresp = json_decode($updateRecord, true); //print_r($updateRecordresp); echo 'update Response."<br/>"'; ArrayDisplay($updateRecordresp); } } } $db->query('update `bmse_zoho_records` set `status`="updated", `update_dttm`="'.$current_date.'" WHERE `id`='.$row['id'].''); $ticketrow++; } } } echo "Ticket Tags".":".$ticketrow; # Add tags for zoho lead - ends here ?>