Class it_url:

/**
 * Get simple URL with timeout and one retry. Can be called statically. Times out, calls it::error for all errs
 *
 * @param $p parameter array with the following keys
 * @param $p['url']           url to get, defaults to constructor URL
 * @param $p['assoc']         Return [ 'data' => string, 'status' => int, 'cookies' => array, 'headers' => array, 'errstr' => string ] instead of just data
 * @param $p['headers']       optional assoc array of HTTP headers to send, e.g. ['Host' => "foo"]
 * @param $p['safety']        DEPRECATED. 0 = ignore errors, 1 = errors, 2 = fatals
 * @param $p['it_error']      extra arguments for it_error or false to ignore errors
 * @param $p['timeout']       inactivity timeout seconds, default 5. fractions ok. silent by default
 * @param $p['totaltimeout']  timeout for the whole attempt but see $['retry']
 * @param $p['maxlength']     maximum length of response
 * @param $p['filemtime']     Add HTTP header to only fetch when newer than this, otherwise return true instead of data
 * @param $p['data']          POST data array with key-value pairs
 * @param $p['files']         [fieldname => filename] of files to upload
 * @param $p['writefunction'] function to be called whenever data is received (for server-sent-events etc.)
 * @param $p['fetchsleep']    Number of seconds to wait after fetch, fractions ok
 * @param $p['followlocation']Follow redirects [true]
 * @param $p['retries']       Number of retries if download fails, default 1
 * @param $p['retrysleep']    Number of seconds to wait before retry (additional to fetchsleep), fractions ok
 * @param $p['accept_encoding'] Contents of the "Accept-Encoding: " header. Enables decoding of the response. Set to null to disable, "" (default) for all supported encodings.
 * @param $p['postprocess']   function called with content and $p which has it_error. returns content or null (which triggers retry)
 * @param $p['protocols']     Array of protocols to accept, defaults to ['http', 'https'], @see curl_opts for other values
 * @param $p['empty_on_fail'] Return empty page if http status code is >= 400
 * @return Content of resulting page (considering redirects, excluding headers or false on error) or array (empty on error) if 'assoc' => true
 */
static function get($p = [])
{
    return (new static)->_get($p);
}