$_POST["firstname"] ?? "", 'lastname' => $_POST["lastname"] ?? "", 'email' => $_POST["email"] ?? "", 'mobile' => $_POST["telephone"] ?? "", // Check for bot detection 'notes' => $_POST["notes"] ?? "", ]; // URL-encode the data $dataString = http_build_query($formData); $options = [ 'http' => [ 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => $dataString, ], ]; echo $options; }