$value]; } } } else { $src = 'assets/resources/sota.txt'; if (copy($src, $file)) { $this->get($query); } else { log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file); } } return $json; } // fetches the summit information from SOTA public function info($summit) { $url = 'https://api-db2.sota.org.uk/api/summits/' . $summit; // Let's use cURL instead of file_get_contents // begin script $ch = curl_init(); // basic curl options for all requests curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); // use the URL we built curl_setopt($ch, CURLOPT_URL, $url); $summit_info = curl_exec($ch); // Close cURL handle curl_close($ch); return $summit_info; } }