android_income_sms_gateway_webhook icon indicating copy to clipboard operation
android_income_sms_gateway_webhook copied to clipboard

php json empty post issue

Open jpph opened this issue 3 years ago • 0 comments

Took me a while to understand why my post var was empty, it is because of the json type! I think would be nice to add in the doc that you have to decode it manually in php script. Or include an example:

<?php

$_POST = json_decode(file_get_contents('php://input'), true);

$text = "N/A";
if(isset($_POST["text"])){
     $text =  $_POST["text"];
}
$from = "N/A";
if(isset($_POST["from"])){
    $from =  $_POST["from"];
}
mail ( "[email protected]", "from ".$from, $text);
echo "OK";
?>

jpph avatar May 19 '22 17:05 jpph