authentification avec cUrl
Bonjour,
pouviez vous sil vous plait maider à resoudre ce probleme?
je dois me logger sur notre platforme universitaire et retirer des informations par curl php afin de remplir un calendrier concu pour notre application, mais le script que jai ne fonctionne pas.
en voici le script en question:
Code:
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;
?> |
Merci d'avance