美好的一天每个人。我目前正在编程Moodle。由于我还没有在他们的论坛中得到任何答案,所以我不得不在这里问问,因为我真的很需要帮助。我的cURL如何绕过Moodle登录页面?关于MURI上的cURL的帮助
$ckfile = tempnam("/tmp","CURLCOOKIE");
$ch = curl_init(http://127.0.0.1/login/index.php);
$data = array('username' => 'admin', 'password' => 'Admin_123');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$url = "http://127.0.0.1/mod/quiz/report.php?q=4&mode=analysis";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIEFILE, $ckfile);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
echo $output;
curl_close($ch);
鉴于此代码,我已经成功登录的管理员,但问题是,我仍然停留在登录页面,而不是程序的URL(http://127.0.0.1/mod/quiz /report.php?q=4 & mode = analysis)这应该是我的目标。我想如何绕过登录页面?任何帮助将不胜感激。谢谢!
你曾经执行连接到登录页面吗? – 2011-09-17 12:15:46
在某种程度上,我这样做是因为左上角我看到我成功登录,但我仍然卡在登录页面。 – POGI