我需要在 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我也有用戶名和密碼,但我不知道如何使用它們。
- 1 回答
- 0 關注
- 139 瀏覽
添加回答
舉報
0/150
提交
取消