donations.php

This commit is contained in:
schrom01 2023-02-16 14:27:36 +01:00
parent 80ea8c84f9
commit de0d09f9c8
1 changed files with 3 additions and 2 deletions

View File

@ -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);
var_dump(createDonation(50));