/** * Makes a request to the URL by using the preferred method * @param string $uri URL to call * @param array $options An array of parameters for both `curl` and `fopen` * @return string The response of the request */ public static function get($uri = '', $options = [], $callback = null) { if (!self::isCurlAvailable() && !self::isFopenAvailable()) { throw new \RuntimeException('Could not start an HTTP request. `allow_url_open` is disabled and `cURL` is not available'); } $options = array_replace_recursive(self::$defaults, $options); $method = 'get' . ucfirst(strtolower(self::$method)); self::$callback = $callback; return static::$method($uri, $options, $callback); }
/** * Makes a request to the URL by using the preferred method * @param string $uri URL to call * @param array $options An array of parameters for both `curl` and `fopen` * @param callable $callback Either a function or callback in array notation * @return string The response of the request */ public static function get($uri = '', $options = [], $callback = null) { if (!self::isCurlAvailable() && !self::isFopenAvailable()) { throw new \RuntimeException('Could not start an HTTP request. `allow_url_open` is disabled and `cURL` is not available'); } // disable time limit if possible to help with slow downloads if (!Utils::isFunctionDisabled('set_time_limit') && !ini_get('safe_mode')) { set_time_limit(0); } $options = array_replace_recursive(self::$defaults, $options); $method = 'get' . ucfirst(strtolower(self::$method)); self::$callback = $callback; return static::$method($uri, $options, $callback); }
/** * Makes a request to the URL by using the preferred method * * @param string $uri URL to call * @param array $options An array of parameters for both `curl` and `fopen` * @param callable $callback Either a function or callback in array notation * * @return string The response of the request */ public static function get($uri = '', $options = [], $callback = null) { if (!self::isCurlAvailable() && !self::isFopenAvailable()) { throw new \RuntimeException('Could not start an HTTP request. `allow_url_open` is disabled and `cURL` is not available'); } // check if this function is available, if so use it to stop any timeouts try { if (!Utils::isFunctionDisabled('set_time_limit') && !ini_get('safe_mode') && function_exists('set_time_limit')) { set_time_limit(0); } } catch (\Exception $e) { } $options = array_replace_recursive(self::$defaults, $options); $method = 'get' . ucfirst(strtolower(self::$method)); self::$callback = $callback; return static::$method($uri, $options, $callback); }