Garethp Posted April 3, 2010 Share Posted April 3, 2010 Ok, so I'm trying to AutoLogin with my account on a site called GaiaOnline. I can't remember why I started (it was 3 in the morning) but now it's turned into a kind of an annoying pest to me. Everytime I try to login, it says that "The information you submitted is incorrect. Are you sure you have cookies enabled?" which is different to the message it gives for incorrect username and password. Here's my code <?php $POST = array ( 'username'=>'', 'password'=>'', 'redirect'=>'http://www.gaiaonline.com/mygaia/', 'token'=>'958394166.1270267057.1394276344', 'sid'=>'d31e9335esyix02kvvbu00antruebzd0', 'signInButton'=>'Log In', ); $URL = 'http://www.gaiaonline.com/auth/login/'; $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)"; $vars = ""; foreach($POST as $k=>$v) { $vars .= "$k=$v&"; } $ckfile = "cookie.txt"; $ch = curl_init ("http://gaiaonline.com/"); curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile); curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec ($ch); curl_close ($ch); $ch = curl_init($URL); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $vars); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile); curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_REFERER, 'http://gaiaonline.com/'); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); $store = curl_exec ($ch); $info = curl_getinfo($ch); $store = htmlentities($store); // CLOSE CURL curl_close ($ch); echo "<pre>$store</pre>"; ?> Ofcourse I enter my username and password. $POST is an array that contains all the same post information that is given by their login form. I'm not sure where I'm going wrong. I have a useragent, and a cookie file (which exists, but for some reason it's always empty) and I've even got the script visiting home page to collect the cookies a normal user would before logging in. I don't suppose anyone has any feedback? Link to comment https://forums.phpfreaks.com/topic/197438-curl-autologin/ Share on other sites More sharing options...
monkeytooth Posted April 3, 2010 Share Posted April 3, 2010 your retrieving the cookies, storing them, but are you sending them back? don't know if that makes sense im kind of in the same boat as you. fried beyond compare at 3 am coding, coding coding.. Link to comment https://forums.phpfreaks.com/topic/197438-curl-autologin/#findComment-1036304 Share on other sites More sharing options...
Garethp Posted April 3, 2010 Author Share Posted April 3, 2010 I'm not entirely sure (I'm not an expert at cURL) but I believe my resources said that curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile); curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); was write and read respectively, so I think so Link to comment https://forums.phpfreaks.com/topic/197438-curl-autologin/#findComment-1036344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.