Trying to login with curl but no luck
Posted: Thu Aug 28, 2008 1:46 pm
Hi,
I've been trying a few scripts to login to a friend's site but i've no luck. For example, 2 scripts show as output the login page but it hasn't logged in.
Check this, for example. This script shows the login page as output, but hasn't logged in. Tell me what i should do:
Thanks!
I've been trying a few scripts to login to a friend's site but i've no luck. For example, 2 scripts show as output the login page but it hasn't logged in.
Check this, for example. This script shows the login page as output, but hasn't logged in. Tell me what i should do:
Code: Select all
<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.thesite.com/login.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'usuario=&pass=&&submit=Login');
echo curl_exec($ch);
curl_close($ch);
?>Thanks!