���� ������������������������������������ 'Invalid token']); exit; } // Handle preflight if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { http_response_code(204); exit; } // Get incoming data $input = json_decode(file_get_contents('php://input'), true); $recipient = $input['recipients'][0] ?? []; // Prepare API request $payload = [ "name" => $input['name'] ?? "", "division" => $input['division'] ?? "", "assigned_to" => $input['assigned_to'] ?? "", "template_id" => $input['template_id'], "revenue" => $input['revenue'] ?? "", "api_key" => "030b556f761bedb9efa7547a3daab534c8b77553", "recipients" => [ [ "first_name" => $recipient['first_name'] ?? "", "last_name" => $recipient['last_name'] ?? "", "email" => $recipient['email'] ?? "", "primary" => true ] ] ]; // Send request to ClientPoint $ch = curl_init('https://api.clientpoint.net/v4/clientpoint/create/'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // Respond http_response_code($httpCode); echo ($response);