Wednesday, April 12, 2017

Execute or trigger API call at a specific time from controller - Laravel

I need to make an api call twice and store its value in the database. But the call needs to trigger at exact time. for example: at 07:00:00 AM and 06:00:00 PM.

my code in Controller (laravel)

$parameters = [
        'param1' => 'val1',
        'param2' => 'val2',
        '_token' => Config::get('app.secret')
        ];
        $formattedParameters = http_build_query($parameters);
        $statusCode = 200;
        $url = "url?{$formattedParameters}"; 

        $client = new Client();
        $res = $client->get($url);
        return $res->getBody();



via Murlidhar Fichadia

Advertisement