Had*_*azi 2 httpclient http-headers laravel
我想在 get() 方法中使用 Http Client 发送标头,让我与您分享我的代码。
Http::get('https://subscriptions.zoho.com/api/v1/plans')->withHeader(['Authorization', $zohoToken]);
我想传递这些标头,但不知道如何在 http::get() 请求中传递标头
$header = array(
         'Authorization: Zoho-oauthtoken ' . $accessToken,
         'Content-Type: application/json' );
这里使用withHeaders方法
Http::withHeaders([
     'Authorization' =>  'Zoho-oauthtoken ' . $accessToken,
     'Content-Type' => 'application/json' 
])->get('https://subscriptions.zoho.com/api/v1/plans');