3

I want to add an delay time before calling my api from laravel delay time around 10,20seconds then it should be executed.

My code is :

$base_url = 'https://pk.qareeb.com/';
    $api_path = 'rest/all/V1/orders/';

    $arr['searchCriteria']['filterGroups'][0]['filters'][0]['field'] = 'increment_id';
    $arr['searchCriteria']['filterGroups'][0]['filters'][0]['value'] = $payload;
    $arr['searchCriteria']['filterGroups'][0]['filters'][0]['conditionType'] = '=';

    $url = $base_url . $api_path .'?'. http_build_query($arr);

    $client = new Client();

    $headers = [
        'Authorization' => 'Bearer ' . $token,
        'Accept' => 'application/json',
    ];
    $response = $client->request('GET', $url
        , [
            'headers' => $headers
        ]);

    $statusCode = $response->getStatusCode();
    $body = json_decode($response->getBody()->getContents());

i want to add delay time WHen client is calling the api?

0 Answers0