loadHTML($req1); $inputs = $req1_html->getElementsByTagName("input"); foreach ($inputs as $input) { if ($input->getAttribute("name") == "execution") { $execution = $input->getAttribute("value"); break; } } curl_setopt($s, CURLOPT_URL, $url1); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_COOKIEFILE, "/tmp/" . $username . "-cookies.txt"); curl_setopt($s, CURLOPT_POSTFIELDS, array ( "username" => $username, "password" => $password, "execution" => $execution, "_eventId" => "submit", "geolocalisation" => "" )); $auth = curl_exec($s); if (curl_getinfo($s, CURLINFO_HTTP_CODE) != 200) { if (curl_getinfo($s, CURLINFO_HTTP_CODE) == 302) { return 3; } else if (curl_getinfo($s, CURLINFO_HTTP_CODE) == 403 || curl_getinfo($s, CURLINFO_HTTP_CODE) == 401){ return 2; } else { return 1; } } curl_setopt($s, CURLOPT_URL, $url2); $semestres = curl_exec($s); if (curl_getinfo($s, CURLINFO_HTTP_CODE) != 200) { if (curl_getinfo($s, CURLINFO_HTTP_CODE) == 500) { return 4; } else { return 1; } } $semestres_data = json_decode($semestres, true); $semestres_json = array(); foreach ($semestres_data as $sem) { $id_semestre = $sem['formsemestre_id']; $url = "https://bulletins.iut-velizy.uvsq.fr/services/data.php?q=relev%C3%A9Etudiant&semestre=" . $id_semestre; curl_setopt($s, CURLOPT_URL, $url); $notes_request = curl_exec($s); array_push($semestres_json, json_decode($notes_request)); } curl_setopt($s, CURLOPT_URL, $url3); curl_exec($s); curl_close($s); return $semestres_json; } function footer() { echo '