<?php 

$url = "https://webdev.services.vision4it.de/kunden/xtend2/onboarding_mail.php";

// The data to send to the API
$postData = json_decode('{
  "ignite": [
    "other",
    "telefon"
  ],
  "startdatum": "2024-07-31",
  "employeeType": "Agent",
  "position": "Service Specialist",
  "mykene": "ja",
  "ap": "Stefanie Uhler",
  "areamanager": "Guido Baumeister",
  "name": {
    "vorname": "Andreas",
    "nachname": "Schiefer"
  },
  "kuerzel": "ASC",
  "benutzername": "ASCHI",
  "email": "andreas.schiefer@xtend.de",
  "anrede": "Herr",
  "durchwahl": 1234,
  "agentengruppen": [
    "Aushilfe"
  ],
  "abteilung": "EDV",
  "ms365lizenz": "Basic",
  "infos": "Info 1\nInfo 2"
}');

// Setup cURL
$ch = curl_init($url);
curl_setopt_array($ch, array(
    CURLOPT_POST => TRUE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json;charset=UTF-8'
    ),
    CURLOPT_POSTFIELDS => json_encode($postData)
));

// Send the request
$response = curl_exec($ch);

// Check for errors
if($response === FALSE){
    die(curl_error($ch));
}

// Decode the response
$responseData = json_decode($response, TRUE);

// Close the cURL handler
curl_close($ch);

// Print the date from the response
var_dump($responseData);

?>
