我有一个提供xml输出的URL。它需要用户名和密码,我可以通过浏览器使用的格式访问:PHP通过HTTP身份验证从远程URL获取XML
然而,当我试图通过一个PHP文件来访问它,我得到一个403禁止:
$url = "http://username:[email protected]";
$xml = @simplexml_load_file($url);
print_r($http_response_header);
我已经尝试使用curl并将用户代理设置为浏览器,但这仍然不会回显数据。
编辑:
我使用梨的http请求2,其也给出了403禁止
这仍然给出了403禁止 –
你尝试使用curl和设置CURL_USERPWD? – AndrewPK