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