07.03.2024 -> Hinweise eingebaut; Cookie wird nicht mehr auf der Platte gespeichert;

This commit is contained in:
2024-03-07 15:44:28 +01:00
parent 30c09c19b8
commit 2994444f1a
2 changed files with 11 additions and 12 deletions

View File

@@ -1,8 +1,6 @@
<?php <?php
$cURL = curl_init(); $cURL = curl_init();
$_csrf = ''; $_csrf = '';
$userMail = 'xxx@yyyy';
$userPassword = 'password';
//Curl Optionen setzen //Curl Optionen setzen
function diveraWebCURL($_url,$_post=''){ function diveraWebCURL($_url,$_post=''){
@@ -18,8 +16,7 @@
}else{ }else{
curl_setopt($cURL, CURLOPT_POST, false); curl_setopt($cURL, CURLOPT_POST, false);
} }
curl_setopt($cURL, CURLOPT_COOKIEJAR, __DIR__.'/data/diveraWebConnectCookie.txt' ); curl_setopt($cURL, CURLOPT_COOKIEFILE, NULL);
curl_setopt($cURL, CURLOPT_COOKIEFILE, __DIR__.'/data/diveraWebConnectCookie.txt' );
curl_setopt($cURL, CURLINFO_HEADER_OUT, true); curl_setopt($cURL, CURLINFO_HEADER_OUT, true);
} }
@@ -28,9 +25,6 @@
function diveraWebLogin(){ function diveraWebLogin(){
global $cURL,$_csrf,$userMail,$userPassword; global $cURL,$_csrf,$userMail,$userPassword;
//Cookie Löschen falls logout nicht geklappt hat, oder vergessen wurde
unlink(__DIR__.'/data/diveraWebConnectCookie.txt');
//_csrf der Session ermitteln //_csrf der Session ermitteln
$url = 'https://app.divera247.com/login.html'; $url = 'https://app.divera247.com/login.html';
diveraWebCURL($url); diveraWebCURL($url);
@@ -64,7 +58,7 @@
return true; return true;
}else{ }else{
$now = new DateTime(); $now = new DateTime();
file_put_contents(__DIR__.'/data/diveraWebConnectError.log',$now->format('Ymd\THis').' || Curl error: ' . curl_error($cURL).print_r($cURL,true),FILE_APPEND); file_put_contents(__DIR__.'/diveraWebConnectError.log',$now->format('Ymd\THis').' || Curl error: ' . curl_error($cURL).print_r($cURL,true),FILE_APPEND);
return false; return false;
} }
} }

View File

@@ -1,21 +1,26 @@
!!! DAS SCRIPT IST NUR IN EINER GESICHERTEN UMGEBUNG ZU NUTZEN !!!
Das Speichern von Zugangsdaten auf öffentlichen Servern stellt ein hohes Risiko da!
Nenninger N-Tools.de Nenninger N-Tools.de
* 05.03.2024 -> Erste Version Benutzer CSV Export * 05.03.2024 -> Erste Version Benutzer CSV Export
* 07.03.2024 -> Hinweise eingebaut; Cookie wird nicht mehr auf der Platte gespeichert;
curl und php >= 7.4 curl und php >= 7.4
Mit diesem Script, kann man die Beutzer von Divera als CSV exportieren. Mit diesem Script, kann man die Beutzer von Divera als CSV exportieren.
im Path des Scripts "diveraWebConnect.php" muss eine Order "data" angelegt sein (Cookieablage + evtl. Log)
der Verwendete Zugang muss Berechtigung auf die Verwaltung haben der Verwendete Zugang muss Berechtigung auf die Verwaltung haben
Beispiel: Beispiel:
<?php <?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
include_once(__DIR__.'/php/diveraWebConnect.php'); include_once(__DIR__.'/php/diveraWebConnect.php');
$userMail = 'xxx@yyyy';
$userPassword = 'password';
echo diveraWebExportCSV(); echo diveraWebExportCSV();
?> ?>