REST intergation
-
is there more documentation about using the rest api with metforms?
any example code?i try to use the rest api integration to add some rules for sending an email with the form data but somehow my code seems to do nothing. when i test it with postman it seems to work just fine.
<?php
header(“Access-Control-Allow-Origin: *”);
header(“Content-Type: application/json; charset=UTF-8”);$text = “”;
foreach($_REQUEST as $key => $value) {
if($value != “”) {
$mailArr[$key] = $value;
$text = $text . $key . “: ” .$value . “\n”;
}
}//apply the rules
//send mail
$empfaenger = “[email protected]”;
$betreff = “Die Mail-Funktion”;
$from = “From: Vorname Nachname <[email protected]>”;mail($empfaenger, $betreff, $text, $from);
$json_response = json_encode($mailArr);
echo $json_response;
?>
The topic ‘REST intergation’ is closed to new replies.