1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| <?php
//Create an array, where the key is the field name and the value, the value of that field
$fields = array(
"username" => "vblva",
"password" => "flgflla",
);
//Init curl
$ch = curl_init();
//Set curl options
$options = array(
//Url to login page
CURLOPT_URL => "https://studip.hochschule-trier.de/index.php?again=yes",
//The file to save cookies in
CURLOPT_COOKIEJAR => "cookie.txt",
//The file to get cookies from
CURLOPT_COOKIEFILE => "cookie.txt",
//Return the page instead of printing it out
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_RETURNTRANSFER => true,
//Post data
CURLOPT_POST => true,
//Set the fields
CURLOPT_POSTFIELDS => $fields
);
//Set all the options
curl_setopt_array($ch, $options);
//Execute the script, you are now logged in
curl_exec($ch);
//Change url to the index page
curl_setopt($ch, CURLOPT_URL, "https://studip.hochschule-trier.de/resources.php?search_send=yes&quick_view=search&quick_view_mode=");
//Save the index page in a variable
$page = curl_exec($ch);
//Show the page
echo $page;
?> |
Partager