donations.php

This commit is contained in:
schrom01 2023-02-16 14:45:36 +01:00
parent 3c9dd63f71
commit a085556519
1 changed files with 4 additions and 3 deletions

View File

@ -1,13 +1,14 @@
<?php <?php
function createDonation($amount) { function createDonation($amount) {
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/ $dolibarrURL = "https://dolibarr.romanschenk.ch/api/index.php/donations";
$BusinesspartnerID = "220";
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://dolibarr.romanschenk.ch/api/index.php/donations'); curl_setopt($ch, CURLOPT_URL, $dolibarrURL);
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\": ".$amount.", \"date\": 1676545200}"); curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"amount\": ".$amount.", \"date\": 1676545200, \"societe\": ".$BusinesspartnerID."}");
$headers = array(); $headers = array();
$headers[] = 'Content-Type: application/json'; $headers[] = 'Content-Type: application/json';