[英]response bad request in http request with php
When i try to send a http request it return me a status 400 (Bad request , invalid headers) the API require an access token and Content Type:application/x-www-form-urlencoded this is my code : the access token is very long please help me当我尝试发送 http 请求时,它返回状态 400(错误请求,无效标头)API 需要访问令牌和内容类型:application/x-www-form-urlencoded 这是我的代码:访问令牌非常长请帮帮我
$response = Http::contentType('application/x-www-form-urlencoded')
->withToken($access_token)
->timeout('2000')
->get('https://example /.../...',[
]);`
use withHeaders()
ref link https://laravel.com/docs/8.x/http-client#headers使用withHeaders()
参考链接https://laravel.com/docs/8.x/http-client#headers
$response = Http::withHeaders(["Content-Type"=>"application/x-www-form-urlencoded"])
->withToken($access_token)
->timeout('2000')
->get('https://example /.../...',[
]);`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.