【发布时间】:2026-02-04 04:45:01
【问题描述】:
我需要在Debian 9下用php7.0调用ODATA服务。
我正在尝试使用“file_get_contents”函数,但是当我运行脚本时
$call_opts=array(
"http"=>array(
"method"=>"GET",
"header"=>"Content-type: application/x-www-form-urlencoded",
)
);
//
$call_context=stream_context_create($call_opts);
$call_res_json=file_get_contents($url,false);
它返回以下内容:
Warning: file_get_contents(http://<URL>): failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized
我也有用户名和密码,但是不知道怎么用。
【问题讨论】:
标签: php odata file-get-contents