From de0d09f9c8591f3d6904545417b1ec794bae5be1 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 16 Feb 2023 14:27:36 +0100 Subject: [PATCH] donations.php --- donations/donations.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/donations/donations.php b/donations/donations.php index a864afa..77d2785 100644 --- a/donations/donations.php +++ b/donations/donations.php @@ -7,7 +7,7 @@ function createDonation($amount) { curl_setopt($ch, CURLOPT_URL, 'https://dolibarr.romanschenk.ch/api/index.php/donations'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"amount\": 50, \"date\": 1676545200}"); + curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"amount\": ".$amount.", \"date\": 1676545200}"); $headers = array(); $headers[] = 'Content-Type: application/json'; @@ -20,6 +20,7 @@ function createDonation($amount) { echo 'Error:' . curl_error($ch); } curl_close($ch); + return $result; } -echo createDonation(50); \ No newline at end of file +var_dump(createDonation(50)); \ No newline at end of file