I'm trying to login to a curl account but it does not go to the final page.
Site map:
Does anyone know why curl does not access or go through this page?
My code.
$f = fopen('cookies.txt', 'w');
$fp = fopen("cookies.txt", "w");
fclose($fp);
$url = "";
$postfields = array();
$postfields[''] = '';
$postfields[''] = '';
$postfields[''] = '';
$postfields[''] = '';
$postfields[''] = '';
$postfields[''] = '';
$postfields[''] = '';
$postfields[''] = '';
$tmpfname = dirname(__FILE__).'/cookies.txt';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
//curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(array()));
//curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_POSTREDIR, -1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, -1);
//curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_STDERR, $f);
curl_setopt($ch, CURLOPT_COOKIEJAR, $tmpfname );
curl_setopt($ch, CURLOPT_COOKIEFILE, $tmpfname );
//curl_setopt($ch, CURLOPT_REFERER, $url);
$redirectURL = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL );
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$status_url = curl_getinfo($ch , CURLINFO_EFFECTIVE_URL);
curl_setopt($ch, CURLOPT_ENCODING, "");
$err = curl_error($ch);
//ob_start();
$ret = curl_exec($ch); // Get result after login page.
$redirectedUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
curl_close ($ch);
echo $ret;