Hey all, I'm not new to the site but I am new to the forum. I've come to a dead-end and require some help or suggestions. I'm attempting to login to my school website so I can get new homework assigns and what not, but I'm having issues with the initial login. Here's my code:
function CCdotCOM() {
$url = "https://www.schoolsite.com/cgi-bin-secure/login.cgi";
$post = "UserName=myemail@gmail.com&Password=mypassword";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$cookie_file_path = "C:/apache2triad/htdocs/_test/cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
curl_setopt ($ch, CURLOPT_COOKIE, session_name().'='.session_id() );
curl_setopt ($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_setopt ($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
}
The problem is with the username, if I take out .com from my email address I will get the proper error 'no username found' when attempting to login. If I put the .com in, all that is printed out to the page is '1'.