Im using PHP curl to sign into a Website, my code looks like this:
<?php
$Luser = "";
$Lpass = "";
if(isset($_POST['username']) && isset($_POST['password']))
{
$Luser = $_POST['username'];
$Lpass = $_POST['password'];
$L_info="http://registration.zwinky.com/registration/loginAjax.jhtmlusername=".$Luser."&password=".$Lpass;
$zwinky_login_file = file_get_contents($L_info, true);
if (substr($zwinky_login_file, 12, 1) == "u"){ $message = "Blank username!"; }
if (substr($zwinky_login_file, 12, 1) == "p"){ $message = "Blank password!"; }
if (substr($zwinky_login_file, 12, 1) == "w"){ $message = "Wrong user/pass combination!"; }
if (substr($zwinky_login_file, 12, 1) == "s"){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL , $L_info);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, "sessions/".$Luser);
curl_setopt($ch, CURLOPT_COOKIEJAR, "sessions/".$Luser);
$response = curl_exec($ch);
curl_close($ch);
$_SESSION['username'] = $Luser;
$_SESSION['password'] = $Lpass;
header('Location: http://idane.me/start.html');
}
echo($message);
}
?>
But im getting a Error :
Warning: Cannot modify header information - headers already sent by (output started at /customers/2/9/0/idane.me/httpd.www/login.php:49) in /customers/2/9/0/idane.me/httpd.www/login.php on line 73
Line 73:
header('Location: http://idane.me/start.html');
Is there something wrong?