genderwatchprotocol/donations/donations.php

25 lines
791 B
PHP
Raw Normal View History

2023-02-16 14:25:14 +01:00
<?php
function createDonation($amount) {
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
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}");
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Accept: application/json';
$headers[] = 'Dolapikey: 4mQX4x4x65MlkGZ9HUD5A4oElqTn92kl';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
}
echo createDonation(50);