Skip to content

Instantly share code, notes, and snippets.

@maintainer64
Created February 19, 2023 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maintainer64/977c55a87ef95bfe41bd2f2b6f1063be to your computer and use it in GitHub Desktop.
Save maintainer64/977c55a87ef95bfe41bd2f2b6f1063be to your computer and use it in GitHub Desktop.
Простая отправка данных в ноушен форму и валидация Email
<?php
$value = $_POST["text"];
if (filter_var($value, FILTER_VALIDATE_EMAIL)) {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://notionforms.io/api/forms/emailsvr/answer',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"ff1881a5-3a4d-4ed1-b716-f91eba883632": "'.$value.'"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
echo "ok";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment