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.