使用php响应http请求中的错误请求
当我尝试发送http请求时,它会返回状态400(请求错误,标头无效) API需要访问令牌和内容类型:application/x-www-form-urlencoded 这是我的代码: 访问令牌非常长 请帮帮我使用php响应http请求中的错误请求,php,laravel,rest,Php,Laravel,Rest,当我尝试发送http请求时,它会返回状态400(请求错误,标头无效) API需要访问令牌和内容类型:application/x-www-form-urlencoded 这是我的代码: 访问令牌非常长 请帮帮我 $response = Http::contentType('application/x-www-form-urlencoded') ->withToken($access_token) ->timeout('2000')
$response = Http::contentType('application/x-www-form-urlencoded')
->withToken($access_token)
->timeout('2000')
->get('https://example /.../...',[
]);`
使用withHeaders()
ref链接
$response=Http::withHeaders([“内容类型”=>“应用程序/x-www-form-urlencoded”])
->withToken($access\u token)
->超时('2000')
->得到('https://example /.../...',[
]);`