sexyrussian Posted November 7, 2012 Share Posted November 7, 2012 Okay so basically I've been trying to do something I've never done before, which would be sign into a website, go to a certain form, fill it out and submit it, then repeat every 10 minutes. I don't know how to do this. I attempted but I didn't use cookies or whatever. So the website is crusadertrav.com and the building is barracks. First here is the login page <form action="index.php" method="post" name="login"> <input type="hidden" name="ft" value="a4" /> <input id="loginNameID" name="name" type="text" value="" class="loginTextField interface_textfield "/> <input id="loginPasswordID" name="password" type="password" value="" class="loginTextField interface_textfield "/> <input type="hidden" name="login" value="1311372931" /> <a href="#" onclick="document.forms[0].submit()" id="loginButton" class="button loginButton interface_forms_button_loginbutton"><span class="interface_forms_button_loginbutton"></span>Login</a> <input type="submit" name="hiddenSubmit" class="hiddenSubmit"/> </form> Then here is the barracks form <form method="post" name="snd" action="build.php?id=33"> <input type="text" class="text" id="_tf11" name="tf[11]" value="0" maxlength="4"> <input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="assets/x.gif" alt="Training"></p></form> Please note that I deleted as much of raw html from both snippets as possible. if this is a problem i can post the entire thing. <?php //create array of data to be posted $post_data['tf[11]'] = '10000'; $post_data['s1'] = 'ok'; //traverse array and prepare data for posting (key1=value1) foreach ( $post_data as $key => $value) { $post_items[] = $key . '=' . $value; } //create the final string to be posted using implode() $post_string = implode ('&', $post_items); //create cURL connection $curl_connection = curl_init('http://crusadertrav.com/build.php?id=33'); //set options curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); //set data to be posted curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); //perform our request $result = curl_exec($curl_connection); //show information regarding the request print_r(curl_getinfo($curl_connection)); echo curl_errno($curl_connection) . '-' . curl_error($curl_connection); //close the connection curl_close($curl_connection); ?> So somehow cookies must be added to make it work. Please help me. If you wish I could pay you a fee, please note that I do not mean to insult everyone and make you guys feel like workers for hire when I say I am willing to pay a fee. I just really really want this. please help me. Quote Link to comment https://forums.phpfreaks.com/topic/270400-travian-curl-bot/ Share on other sites More sharing options...
MDCode Posted November 7, 2012 Share Posted November 7, 2012 So...you want help to create an illegal program? But oh wait, you'll pay for it?!? lol Quote Link to comment https://forums.phpfreaks.com/topic/270400-travian-curl-bot/#findComment-1390868 Share on other sites More sharing options...
sexyrussian Posted November 7, 2012 Author Share Posted November 7, 2012 It's a private server and there are no rules against it.. therefore I want you to help me create a LEGAL macro that fills out forms every 10 minutes. Quote Link to comment https://forums.phpfreaks.com/topic/270400-travian-curl-bot/#findComment-1390951 Share on other sites More sharing options...
MMDE Posted November 8, 2012 Share Posted November 8, 2012 I've done similar stuff many times. I don't have the time to help you now, lol, but payment for such an easy job would have been nice! xD http://forums.phpfreaks.com/topic/270290-tumblr-curl-not-working/ ^ Try to understand what I did there, and read the link to another similar case I've solved before. They are all solved the same way. You need to duplicate the way the website expects the web browser to act to achieve your goal. If you are not able to do it on your own, send me a pm or something. Quote Link to comment https://forums.phpfreaks.com/topic/270400-travian-curl-bot/#findComment-1390968 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.