donations.php
cleanup
This commit is contained in:
+14
-4
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user