我正在尝试在需要用户名和密码的网站之外获取一些价值形式。通常我需要先去登录页面(https://xxx.xxx.xxx/HomeAccess),然后去https://xxx.xxx.xxx/xxx.aspx。但是如果没有登录就进入页面xxx.aspx,我会得到错误“页面无法显示,因为发生了内部服务器错误。”;
在 PHP 中我正在尝试使用此代码
<?php
$ch = curl_init();
$url = 'https://xxx.xxx.xxx/xxx.aspx';
$username ='uuuuu';
$password ='ppppp';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
print $output;
?>
我得到了空白页。
任何想法?谢谢