parent
f0a1149558
commit
456afc6a12
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/read_write_xlsx.php';
|
||||
require $_SERVER['DOCUMENT_ROOT'] . '/databaseConnection/databaseConnection.php';
|
||||
$fileName = $_SERVER['DOCUMENT_ROOT'] . '/data/data.xlsx';
|
||||
function objectToArray($object, $fullJSON) {
|
||||
return [$object -> id,
|
||||
|
@ -13,12 +14,8 @@ function objectToArray($object, $fullJSON) {
|
|||
$object -> countWatchD];
|
||||
}
|
||||
|
||||
$databaseAddress = "127.0.0.1";
|
||||
$databasePort = "3306";
|
||||
$databaseName = "u517357132_genderwatchpro";
|
||||
$databaseUser = "u517357132_genderwatchpro";
|
||||
$databasePassword = "zU!7gRHA6x";
|
||||
$conn = new mysqli($databaseAddress, $databaseUser, $databasePassword, $databaseName);
|
||||
|
||||
$conn = getDatabaseConnection();
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
function getDatabaseConnection() {
|
||||
$databaseAddress = "127.0.0.1";
|
||||
$databasePort = "3306";
|
||||
$databaseName = "u517357132_genderwatchpro";
|
||||
$databaseUser = "u517357132_genderwatchpro";
|
||||
$databasePassword = "zU!7gRHA6x";
|
||||
return new mysqli($databaseAddress, $databaseUser, $databasePassword, $databaseName);
|
||||
}
|
|
@ -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';
|
||||
|
|
Loading…
Reference in New Issue