Exemplo n.º 1
0
 public function get($url, $later_than = "-5 minutes")
 {
     $cached_contents = TBA::cache_get($this->cache_dir, $url, $later_than);
     if ($cached_contents !== FALSE) {
         return $cached_contents;
     }
     $options = array('http' => array('header' => "X-TBA-App-Id: {$this->key}", 'method' => "GET"));
     $context = stream_context_create($options);
     $result = file_get_contents("https://www.thebluealliance.com/api/v2/{$url}", false, $context);
     $result = json_decode($result, 1);
     if ($cached_contents === FALSE && !is_null($result)) {
         TBA::cache_set($this->cache_dir, $url, $result);
     }
     return $result;
 }