neel_143 Posted May 2, 2014 Share Posted May 2, 2014 here is two php pages in which in 1st page i retrieve captcha and submitand in 2nd page it sends to a url n only then i can login to that sitethe problem is that i retrieve captcha successfullybut cant connect to 2nd pageits totally lost the cookie or session n run separately and eventually i failed to login cap.php- <?php set_time_limit(0); $cookie = 'c:/xampp/htdocs/img/cookie.txt'; $agent = "Opera/9.80 (J2ME/MIDP; Opera Mini/7.1.32052/34.1697; U; en) Presto/2.8.119 Version/11.10"; $uid = $_REQUEST['uid']; $pwd = $_REQUEST['pwd']; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,"http://ultoo.com/login.php"); curl_setopt($ch, CURLOPT_TIMEOUT, 0); curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_REFERER,"http://ultoo.com/login.php"); $one=curl_exec($ch); preg_match_all("/document.getElementById(.*?).value/",$one,$us); $user = $us[1][10]; $user = str_replace('(', '', $user); $user = str_replace(')', '', $user); $user = str_replace("'", '', $user); //die("<font color='red'><b>".$user."</b></font>"); flush(); $pass = $us[1][9]; $pass = str_replace('(', '', $pass); $pass = str_replace(')', '', $pass); $pass = str_replace("'", '', $pass); $data1 = "$user=$uid&$pass=$pwd&RememberMe=1"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://ultoo.com/login.php"); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*")); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_REFERER, "http://ultoo.com/login.php"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"$data1"); $ct = curl_exec( $ch ); if(stristr($ct,"number & password")) { echo "<font color='red'><b>Invalid U/P</b></font>"; } else { if(stristr($ct,"secure.php")) { curl_setopt($ch, CURLOPT_URL,"http://ultoo.com/secure.php?zxcoiesesscd="); curl_setopt( $ch, CURLOPT_USERAGENT, $agent ); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); $ct=curl_exec($ch); preg_match_all("/document.getElementById(.*?).value/",$ct,$mbll); $mbl = $mbll[1][5]; $mbl = str_replace('(', '', $mbl); $mbl = str_replace(')', '', $mbl); $mbl = str_replace("'", '', $mbl); //die("<font color='red'><b>".$mbl."</b></font>"); flush(); $url = "http://ultoo.com/captcha.php"; curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); //curl_setopt($ch, CURLOPT_POST, 1); $html=curl_exec($ch); curl_close($ch); $name = "img/".rand(1,99999).".png"; $myFile = $name; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $html; fwrite($fh, $stringData); fclose($fh); } } ?> <center> <img src=<?php echo $name; ?>><br> <form method=post action="play.php"> <input type=text name=c> <input type=hidden name=img value=<?php echo $name; ?>> <?php echo '<input type="hidden" name="mbl" value="'.$mbl.'">'; ?> <input type=submit name="submit" value=Earn> andplay.php- <?php set_time_limit(0); error_reporting(0); $cookie = 'c:/xampp/htdocs/img/cookie.txt'; $c = $_REQUEST["c"]; $mbl = $_REQUEST["mbl"]; $agent = "Opera/9.80 (J2ME/MIDP; Opera Mini/7.1.32052/34.1697; U; en) Presto/2.8.119 Version/11.10"; $ch = curl_init(); $post_data2 = "$mbl=nlp&captcha=$c&loginButton=LOGIN"; curl_setopt($ch, CURLOPT_URL,"http://ultoo.com/secure.php"); curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: application/x-www-form-urlencoded","Accept: */*")); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data2); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_REFERER, "http://ultoo.com/login.php"); $dt = curl_exec($ch); if(!stristr($dt,"mywallet.php")) { die("<font color='red'><b>Wrong Captcha.</b></font>"); flush(); } ?> can any one give me a perfect solution to this?i will b thankful to him for lifetime Link to comment https://forums.phpfreaks.com/topic/288175-help-in-captcha-submitting/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.