Pessoal, bom dia!
Estou com uma grande dúvida, estou tentando pegar informações de outro site com o php cUrl, então…
Consigo logar no sistema, só que quando eu vou mudar de página dentro do sistema ele emite uma mensagem que estou sendo redirecionado, se puderem me ajudar agradeço desde já.
<?php
$username = '[email removido]';
$password = 'playgame';
$proxy = 'privado';
$urlEdit = 'https://www.youse.com.br/account/profile/edit';
//$url = 'https://www.youse.com.br/users/sign_in?email='.$usuario;
//login form action url
$url = 'https://www.youse.com.br/users/sign_in?email='.$username;
$postinfo = "user[email]=".$username."&user[password]=".$password;
$cookie_file_path = dirname(__FILE__)."/cookie.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_URL, $url);
CURL_SETOPT($ch,CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
libxml_clear_errors();
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
//set the cookie the site has for certain features, this is optional
curl_setopt($ch, CURLOPT_COOKIE, "cookiename=0");
//CURL_SETOPT($ch,CURLOPT_COOKIEFILE, $cookie_file_path); //Put the full path of the cookie file if you want it to write on it
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec($ch);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);
curl_exec($ch);
curl_exec($ch);
$openNewWindow = openNewWindow($urlEdit, $proxy, $cookie_file_path);
curl_close($ch);
function openNewWindow($urlEdit, $proxy, $cookie){
$ch = curl_init($cookie);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_URL, $urlEdit);
CURL_SETOPT($ch,CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
libxml_clear_errors();
//set the cookie the site has for certain features, this is optional
CURL_SETOPT($ch,CURLOPT_COOKIEFILE, $cookie); //Put the full path of the cookie file if you want it to write on it
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$html = curl_exec($ch);
var_dump($html);die;
return $html;
}
?>