loadHTML($data); $xp = new DOMXpath($dom); $nodes = $xp->query('//input[@name="_csrf"]'); $_csrf = $nodes->item(0); $_csrf = $_csrf->getAttribute('value'); //eigentlicher Login $url = 'https://app.divera247.com/login.html?step=1&msg=&referrer='; $post = '_csrf='.htmlentities($_csrf).'&Login%5Busername%5D='.htmlentities($userMail).'&Login%5Bpassword%5D='.htmlentities($userPassword).'&Login%5Bcookie%5D=0&Login%5Bcookie%5D=1&Login%5Bremember%5D=0'; diveraWebCURL($url,$post); $data = curl_exec($cURL); //Login abschließen $url = 'https://app.divera247.com/login.html?step=3&msg=&referrer='; diveraWebCURL($url); $data = curl_exec($cURL); //Passwort prüfung Verwaltung $url = 'https://app.divera247.com/api/v2/auth/2fa/set-jwt'; $post = 'user_password='.htmlentities($userPassword).''; diveraWebCURL($url,$post); $data = curl_exec($cURL); if($data != '{"success":true}') return false; return true; }else{ $now = new DateTime(); file_put_contents(__DIR__.'/diveraWebConnectError.log',$now->format('Ymd\THis').' || Curl error: ' . curl_error($cURL).print_r($cURL,true),FILE_APPEND); return false; } } //logout function diveraWebLogout(){ global $cURL,$_csrf; $url = 'https://app.divera247.com/logout.html'; $post = '_csrf='.htmlentities($_csrf); diveraWebCURL($url,$post); $data = curl_exec($cURL); curl_close($cURL); } //Benutzer CSV Export mit Mail,Telefon, Quali und Berechtigungen function diveraWebExportCSV(){ global $cURL,$_csrf; if(diveraWebLogin()){ $url = 'https://app.divera247.com/api/v2/management/export-users?type=csv&emails=1&phonenumbers=1&qualifications=1&access=1'; diveraWebCURL($url); $data = curl_exec($cURL); diveraWebLogout(); return $data; } if($_csrf != '') diveraWebLogout(); return false; } ?>