[英]response bad request in http request with php
當我嘗試發送 http 請求時,它返回狀態 400(錯誤請求,無效標頭)API 需要訪問令牌和內容類型:application/x-www-form-urlencoded 這是我的代碼:訪問令牌非常長請幫幫我
$response = Http::contentType('application/x-www-form-urlencoded')
->withToken($access_token)
->timeout('2000')
->get('https://example /.../...',[
]);`
使用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.