Ejemplo n.º 1
0
 public function registerSchedule($schedule)
 {
     $schedule->call(function () {
         $appId = Setting::get('appId');
         $curl = curl_init();
         curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'http://openexchangerates.org/api/latest.json?app_id=' . $appId, CURLOPT_USERAGENT => 'OEPABOT'));
         $data = curl_exec($curl);
         curl_close($curl);
         if (!empty($data) || $data != "false" || $data != false) {
             Setting::set('data', $data);
         }
     })->hourly();
     /*$schedule->call(function(){
                 $appId = Setting::get('appId');
                 
                 $curl = curl_init();
                 
                 curl_setopt_array($curl, array(
                     CURLOPT_RETURNTRANSFER => 1, 
                     CURLOPT_URL => 'http://openexchangerates.org/api/currencies.json',
                     CURLOPT_USERAGENT => 'OEPABOT'
                 ));
     
                 $data = curl_exec($curl);
                 curl_close($curl);
                 Setting::set('currencies', $data);
             })->weekly();*/
 }
Ejemplo n.º 2
0
 public function appId()
 {
     return Setting::get('appId');
 }