Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/270400-travian-curl-bot/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/270400-travian-curl-bot/#findComment-1390968
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.