Example #1
0
 /**
  * Contact OSCARS instance, get active and scheduled circuits
  * and save in MEICAN database. After that, updates all circuits
  * of same type for consistence.
  */
 public static function loadCircuits($oscarsUrl)
 {
     $ch = curl_init();
     $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CONNECTTIMEOUT => 2, CURLOPT_USERAGENT => 'Meican', CURLOPT_URL => $oscarsUrl);
     curl_setopt_array($ch, $options);
     $output = curl_exec($ch);
     curl_close($ch);
     Yii::trace($output);
     if ($output != null) {
         OscarsService::saveCircuits(json_decode($output));
         return true;
     } else {
         return false;
     }
 }