PHP错误:HTTP请求失败! http/1.0 400不良要求
我将带有file_get_contents的API URL称为
$options_access_token = array(
'http'=>array(
'ignore_errors' => true,
'method'=>"POST",
'header'=>"Authorization:Bearer mykey"
)
);
$context = stream_context_create($options_access_token);
$access_token = file_get_contents($url_access_token, false, $context);
print_r($access_token);exit;
“ http请求失败!http/1.0 400不良请求” 然后,我尝试ignore_errors'=>是的,
在HTTP请求上,它给出了另一个错误,它是“客户端向HTTPS服务器发送了HTTP请求”。 URL是“ HTTP”协议。
有什么想法我做错了什么或缺乏?感谢您的答案,这将有所帮助
I call an API url with file_get_contents like this
$options_access_token = array(
'http'=>array(
'ignore_errors' => true,
'method'=>"POST",
'header'=>"Authorization:Bearer mykey"
)
);
$context = stream_context_create($options_access_token);
$access_token = file_get_contents($url_access_token, false, $context);
print_r($access_token);exit;
it give a "HTTP request failed! HTTP/1.0 400 Bad Request"
then i try ignore_errors' => true,
on http request and it gave another error, it was "Client sent an HTTP request to an HTTPS server." the url is "http" protocol.
Any ideas what i do wrong or lacking? thanks for any answer it will be helpful
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论