/** * Wrapper for file_get_contents that attempts to use CURL if allow_url_fopen is disabled. * * @param string|RequestUtil $source * @param type $url * @return type * @throws Exception */ public static function getContents($source, $use_include_path = false, $context = null) { if (self::tryCurl($source instanceof RequestUtil ? $source->url : $source)) { if ($source instanceof RequestUtil) { $ch = $source->getCurlHandle(); } else { $ch = self::curlInit($source, $context); } return @curl_exec($ch); } else { if ($source instanceof RequestUtil) { $context = $source->getStreamContext(); $source = $source->url; } // Use the usual copy method return @file_get_contents($source, $use_include_path, $context); } }