POST data - how to read data from body with php ?

adam M 09 Mar, 2021
my page with a form (CF7) is called with some JSON formatted POST method - it is some kind of a notification.
How can I use some of this data in my form ?
I found a solution - do You think it is proper ?

I put an php action :
<?php
$body = file_get_contents('php://input');
$dane = trim($body);
$arraydane = json_decode($dane, true);
echo $arraydane["order"]["status"];
?>

it's working🙂
comments welcome
adam M 12 Mar, 2021
in ChronoEngine documentation I found that all data is passed to the {data:} array on loading the form . Yes ... but - I could not find the data from post method. So I found this solution to get this data🙂
Array $arraydane holds all the data passed to the form when post method is used to call my form.

Hope - I use proper terms in this describtion🙂 I'm a hobbist programmer🙂

Adam
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger