error_reporting(E_ALL);
function login($url,$data) {
$fp = fopen("cookie.txt", "w");
fclose($fp);
$login = curl_init();
curl_setopt($login, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($login, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($login, CURLOPT_FOLLOWLOCATION, 1);
$fh = fopen('curl.log', 'w');
curl_setopt($login, CURLOPT_VERBOSE, 1);
curl_setopt($login, CURLOPT_STDERR, $fh);
curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($login, CURLOPT_TIMEOUT, 40000);
curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($login, CURLOPT_URL, $url);
curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($login, CURLOPT_POST, TRUE);
curl_setopt($login, CURLOPT_POSTFIELDS, $data);
ob_start();
return curl_exec ($login);
ob_end_clean();
curl_close ($login);
unset($login);
}
echo login($LoginLink,$LoginData);
This is the code im currently trying to use to login into a website. (Without the $LoginLink and $LoginData Variables because it contains my username and password)
Any ideas why im getting the errors stated in the title? Further Information needed from the curl.log?
I appreciate any help.
Your code after
return curl_exec ($login);
won't run.