donations.php

cleanup
This commit is contained in:
schrom01
2023-02-16 20:46:12 +01:00
parent f0a1149558
commit 456afc6a12
3 changed files with 27 additions and 10 deletions
+14 -4
View File
@@ -1,15 +1,25 @@
<?php
$dolibarrURL = "https://dolibarr.romanschenk.ch/";
$dolibarrAPIKey = "4mQX4x4x65MlkGZ9HUD5A4oElqTn92kl";
require $_SERVER['DOCUMENT_ROOT'] . '/databaseConnection/databaseConnection.php';
$conn = getDatabaseConnection();
$sql = "SELECT `value` FROM `dolibarrInformation` WHERE `information` = 'apiKey'";
$result = $conn->query($sql);
$dolibarrAPIKey = mysql_fetch_array($result)["value"];
$conn = getDatabaseConnection();
$sql = "SELECT `value` FROM `dolibarrInformation` WHERE `information` = 'url'";
$result = $conn->query($sql);
$dolibarrURL = mysql_fetch_array($result)["value"];
function createDonation($amount, $dolibarrURL, $dolibarrAPIKey) {
$BusinesspartnerID = "220";
$pulicNote = "Automatisch generiert von genderwatchprotocol.com";
$pulicNote = "Automatisch generiert von genderwatchprotocol";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $dolibarrURL."api/index.php/donations");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"amount\": ".$amount.", \"date\": ".time().", \"socid\": ".$BusinesspartnerID.", \"note_public\": \"Automatisch generiert von genderwatchprotocol.com\"}");
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"amount\": ".$amount.", \"date\": ".time().", \"socid\": ".$BusinesspartnerID.", \"note_public\": \"".$pulicNote."\"}");
$headers = array();
$headers[] = 'Content-Type: application/json';