我正在尝试使用登录安全但无法做到的情况下抓取站点的内容该站点的登录有三个选项用户名,密码,密码这里是我正在使用的代码
<?php
// HTTP authentication
$url = "http://aftabcurrency.com/login_script.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$cookie = 'cookies.txt';
$timeout = 30;
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch,CURLOPT_POSTFIELDS,"user_name=user&user_password=pass&passcode=code");
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>