我试图用卷曲访问此网址在PHP中: https://www.maxityre.fr/search?matchcode=2055516&t=V&l=205&mid=&bquery=&h=55&d=16&seasonAll=on&from=认证,卷曲PHP
但是,由于网站需要验证,我重定向到: https://www.maxityre.fr/
这里是我的尝试到目前为止:
$username='myusername';
$password='mypassword';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.maxityre.fr/search?matchcode=2055516&t=V&l=205&mid=&bquery=&h=55&d=16&seasonAll=on&from=');
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); //status code is 200 thanks to this, otherwise 302
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
但它不工作,我重定向到https://www.maxityre.fr/(我想呼应的内容和我得到的内容)。 我做错了吗?