1use GuzzleHttp\Client;
2class yourController extends Controller {
3
4 public function saveApiData()
5 {
6 $client = new Client();
7 $res = $client->request('POST', 'https://url_to_the_api', [
8 'form_params' => [
9 'client_id' => 'test_id',
10 'secret' => 'test_secret',
11 ]
12 ]);
13 echo $res->getStatusCode();
14 // 200
15 echo $res->getHeader('content-type');
16 // 'application/json; charset=utf8'
17 echo $res->getBody();
18 // {"type":"User"...'
19}
20