首页 > 解决方案 > 在 Guzzle 中获取请求

问题描述

我是 Guzzle 的新手,我正在尝试从我的 api 获取请求

这是我现在拥有的:

  $client = new Client(['base_uri' => 'https://api.harvestapp.com']);

  $request = $client->request('GET', '/v2/time_entries', [
    'headers' => [
      'Authorization' => 'Bearer bearer_key',
      'Harvest-Account-ID' => 'account_id_key']
  ]);
  $request = json_decode($request);
  return new JsonResponse($request);
}

我希望有人可以帮助我!

标签: phpgetguzzle

解决方案


推荐阅读