0
I am trying to log into a system using Curl. But I am not able to log in, I believe the problem is the redirect.
I have a website (meusite.com.br) that has a form. this form calls the send page.php . On this page I have the following code
<?php
//pega os inputs através do furmulário vindo do método POST.
$login = $_POST['login'];
$senha = $_POST['senha'];
$ch = curl_init();
$data['login'] = $login;
$data['senha'] = $senha;
$data['submit'] = 'true';
$dataall = http_build_query($data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_URL, 'http://sistemaweb/login.php');
curl_setopt ($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $dataall);
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, 'http://sistemaweb/dashboard.php');
$a = curl_exec($ch);
echo $a;
curl_close($ch);
?>
the problem occurs when it calls the page. it play to the url meusite.com.br/Dashboard.php instead of systemsweb/Dashboard.php
url does not leave my domain. I have tried it in many ways but I was unsuccessful. I even tried a header Location but it seems that it perceives the session.
Is there any more parameter missing in the CURL process ?