Hello, guys i hope you will help me with this cause i'm a complete newbie.
First 2 words about the goal :
I want to make a PHP script to autologin in one webpage and to get statistics in every 2 minutes. The account is mine so i dont want to scam or anything , just want to automate it cause this info i need in realtime, and refreshed often.
The page login page code looks like this :
<dl>
<dt>Username:</dt>
<dd><input type="text" name="user" size="20" value="" class="input_text" /></dd>
<dt>Password:</dt>
<dd><input type="password" name="passwrd" value="" size="20" class="input_password" /></dd>
</dl>
<dl>
<dt>Minutes to stay logged in:</dt>
<dd><input type="text" name="cookielength" size="4" maxlength="4" value="60" class="input_text" /></dd>
<dt>Always stay logged in:</dt>
<dd><input type="checkbox" name="cookieneverexp" class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>
</dl>
<p><input type="submit" value="Login" class="button_submit" /></p>
and i try login like that :
$_login_url = 'URL of the login'; // url to login
$_user = 'myusername'; // username for login
$_pass = 'mypass'; // password..
$start = microtime(true);
file_get_contents(
$_login_url,
false,
stream_context_create(
array(
'http' => array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => http_build_query(
array(
'user' => $_user,
'passwrd' => $_pass,
'cookielength' => '-1',
//what here ???? 'Login',
)
),
)
)
)
);
$search['from'] = 'Set-Cookie: ';
$search['to'] = ';';
$cookie = array();
//the problem is that i cant login to go to the statistics page, cause site requires login for view.