donations.php
This commit is contained in:
parent
80ea8c84f9
commit
de0d09f9c8
|
@ -7,7 +7,7 @@ function createDonation($amount) {
|
||||||
curl_setopt($ch, CURLOPT_URL, 'https://dolibarr.romanschenk.ch/api/index.php/donations');
|
curl_setopt($ch, CURLOPT_URL, 'https://dolibarr.romanschenk.ch/api/index.php/donations');
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($ch, CURLOPT_POST, 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 = array();
|
||||||
$headers[] = 'Content-Type: application/json';
|
$headers[] = 'Content-Type: application/json';
|
||||||
|
@ -20,6 +20,7 @@ function createDonation($amount) {
|
||||||
echo 'Error:' . curl_error($ch);
|
echo 'Error:' . curl_error($ch);
|
||||||
}
|
}
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo createDonation(50);
|
var_dump(createDonation(50));
|
Loading…
Reference in New Issue