Loading page
The simplest path is a normal HTML form; server-side forwarding needs one cURL call.
<?php
$payload = json_encode([
"name" => $_POST["name"] ?? "",
"email" => $_POST["email"] ?? "",
"message" => $_POST["message"] ?? "",
]);
$ch = curl_init("https://formivo.faizyab.me/api/f/YOUR_FORM_ID");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ["Content-Type: application/json", "Accept: application/json"],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status !== 201) {
http_response_code(502);
echo "Could not send your message.";
exit;
}
header("Location: /thank-you", true, 303);
exit;201 on success. Treat anything else as a failure and show a human message.
| Symptom | Fix |
|---|---|
| curl_exec returns false | Check TLS support and outbound network access. |
| Emails arrive empty | Verify $_POST keys match your form's name attributes. |