ive done my homework and had around 10 examples of using curl, but none of them worked in my case.
this is the final code i'm using
Code: Select all
<?php
$cookiefile = '/temp/cookies.txt';
#2 ways ive tried doing
#$data = array('edit[username]' => 'REMOVED', 'edit[password]' => 'REMOVED', 'edit[submit]' => 'Login');
$data = array('username] => 'REMOVED', 'password' => 'REMOVED', 'submit' => 'Login');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://pokerrpg.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, 'http://pokerrpg.com/furniture_store.php');
$contents = curl_exec($ch);
echo $contents;
curl_close($ch);
?>the page i'm trying is http://pokerrpg.com, you can even look the source code that both of these fields do exist.
when i run it, the output is a login page without logging in, so it does not log in.