I'm trying to call the api inside another api in the foreach loop but the execution time is too long I've tried many ways but the same problem This is my code
<?php
require_once 'vendor/autoload.php';
$client = new GuzzleHttp\Client( ['headers' => ['X-EXEMPLE' => '00-00-10']] );
$res = $client->get('https://api.example.com/index.php/records/orders');
$OrdersData = json_decode( $res->getBody(), true );
foreach ($OrdersData['records'] as $key) {
$res = $client->get('https://api.example.com/index.php/records/users/'.$key['user_id']);
$UserData = json_decode( $res->getBody() );
$User_Name = $UserData->name;
$User_Phone = $UserData->phone;
echo $key['unique_order_id'] . ' ' . $User_Name . ' ' . $User_Phone . '<br />' ;
}
?>