Ich danke dir. Werde ich mir mal durchlesen und probieren und bei Verständnissproblemen mich hier melden
EDIT
[src=php]
//username and password of account
$username = trim($values["BENUTZERNAME"]);
$password = trim($values["PASSWORT123"]);
//set the directory for the cookie using defined document root var
$path = "/ctemp";
//build a unique path with every request to store. the info per user with custom func. I used this function to build unique paths based on member ID, that was for my use case. It can be a regular dir.
//$path = build_unique_path($path); // this was for my use case
//login form action url
$url="https://beispielseite.de/";
$postinfo = "user=".$username."&password=".$password;
$cookie_file_path = $path."/cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
//set the cookie the site has for certain features, this is optional
curl_setopt($ch, CURLOPT_COOKIE, "cookiename=0");
curl_setopt($ch, CURLOPT_USERAGENT,
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
curl_exec($ch);
//page with the content I want to grab
curl_setopt($ch, CURLOPT_URL, "https://beispielseite.de/sichtbar/nur/wenn/eingeloggt/");
//do stuff with the info with DomDocument() etc
$html = curl_exec($ch);
curl_close($ch);
?>
[/src]
hab mich jetzt erstmal durchgeklickt und nach fertigen lösungen gesucht, aber irgendwie wird immer immer eine leere seite angezeigt
wenn ich allerdings die seite so aufrufe, bekomme ich immerhin die loginseite angzeigt
[src=php]
<?php
//step1
$cSession = curl_init();
//step2
curl_setopt($cSession,CURLOPT_URL,"https://beispielseite.de/");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
//step3
$result=curl_exec($cSession);
//step4
curl_close($cSession);
//step5
echo $result;
?>
[/src]
kannst und würdest du mir erklären warum das obige script nichtmal die seite anzeigen kann im vergleich zu der kurzen form ohne login?