1
I’m creating a script what makes login on a page and returns me the Htmlda page /logado
, but it’s not working and from what I saw the code is correct
Where I went wrong?
<?php
if(!empty($_POST["bin"])){
$bin = $_POST["bin"];
$email = explode("|", $bin)[0];
$senha = explode("|", $bin)[1];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://minhaconta.payleven.com.br/login_check");
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 10);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, '_username=' . urlencode($email) . '&_password=' . urlencode($senha));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$dados = curl_exec($ch);
echo "$dados";
}else{ echo 'erro'; }
?>
What appears on the page? What is the end value of
$dados
?– Woss
I wish him to then go to https://minhaconta.payleven.com.br/dashboard and return me whatever is there
– Bruno Lazarine
This did not answer the previous question. What appears on the screen and what is the value in
$dados
? You can use the functionvar_dump
.– Woss
I don’t know if that’s it, but if you use the
CURLOPT_COOKIESESSION
as far as I know it starts a new session, discarding the session data that is on'cookie.txt'
(cookies that have no expiration date = session). That is, it will follow thelocation
and will not use session cookies. I do not know if that is it, I am not confident that this is it, but try to remove this line. :)– Inkeliz
Anderson in data would be the html of my request
– Bruno Lazarine
See in the headers which is the way it goes. If it comes to the next page and goes back to the login page or if it never entered.
– Inkeliz
Remove the cookiesession solved the problem thanks buddy
– Bruno Lazarine