[ [ 'name' => 'email', 'value' => $_POST['email'], ], [ 'name' => 'firstname', 'value' => $_POST['firstname'], ], [ 'name' => 'lastname', 'value' => $_POST['lastname'], ], [ 'name' => 'phone', 'value' => $_POST['phone'], ] ], 'context' => [ 'hutk' => $hubspotutk, 'pageUri' => 'https://zaufane.pl/', 'pageName' => 'zaufane.pl - ebook' ], 'legalConsentOptions' => [ 'consent' => [ 'content' => 'By submitting this form, you agree that we may use the data you provide to contact you with information related to your request/submission and the relevant LinkedIn product. If you are a LinkedIn member, you can control the messages you receive from LinkedIn in your settings. If you are a guest, you can unsubscribe from LinkedIn marketing emails at any time by clicking the unsubscribe link in the email. To learn more, see LinkedIn\'s Privacy Policy.', 'consentToProcess' => true, 'text' => 'I agree to the processing of my personal data by LinkedIn.', 'communications' => [ [ 'value' => true, 'subscriptionTypeId' => 8383894, 'text' => 'I agree to receive marketing communications from LinkedIn.' ] ] ] ] ]; $jsonData = json_encode($postData); // Initialize cURL $ch = curl_init($hubspot_url); // Set cURL options curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); // Execute cURL request $response = curl_exec($ch); // Check for errors if ($response === false) { $error = curl_error($ch); echo "cURL Error: $error"; } else { // Decode response $responseData = json_decode($response, true); if (isset($responseData['redirectUri'])) { header("Location: " . $responseData['redirectUri']); exit(); } else { echo "

" . $response . '

'; } } // Close cURL session curl_close($ch); ?>