我正在尝试使用file_get_contents.I确保在php.ini中启用了allow_url_fopen.截至目前,它告诉我:
[function.file-get-contents]:无法打开流:HTTP请求失败!HTTP/1.1 401未经授权
我正在做的就是以下内容,我可以通过浏览器访问它而没有任何问题.
$url=('http://site/@api/users/=john_smith@site.com/properties');
$xmlString=file_get_contents($url);
Run Code Online (Sandbox Code Playgroud)
我相信这是一个身份验证问题,但不确定如何从脚本本身提供正确的凭据.任何想法将不胜感激.