1
I’ve searched everywhere possible on the web, but so far I can’t understand what’s going wrong with my code.
The thing is, I’m trying to access the student portal of my college, using Curl, my interest is to take each student’s grades to be served to other means.
My problem is at the time of logging in, because I am passing the username and password data, but it does not authenticate and it seems to me that it is not generating authentication cookie.
I’ll put the code q I’m using and then image the head of the college page and the page running locally.
What I want to receive is the page that displays the notes, but I’m not even able to pass the login page.
$url="http://179.189.22.226/corpore.net/Login.aspx";
$cookie="cookie.txt";
$postdata = "txtUser=aquiUsuario&txtPass=aquiSenha&ddlAlias=CorporeRM&btnLogin=Acessar";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_URL, 'http://179.189.22.226/corpore.net/Main.aspx?ShowMode=2&SelectedMenuIDKey=');
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
echo $result;
curl_close($ch);