Basic example


    protected static function set_defaults(&$url, &$headers, &$data, &$type, &$options) {
        if (!preg_match('/^http(s)?:\/\//i', $url$matches)) {
            throw new Exception('Only HTTP(S) requests are handled.', 'nonhttp', $url);
        }

        if (empty($options['hooks'])) {
            $options['hooks'] = new Hooks();
        }

        if (is_array($options['auth'])) {
            $options['auth'] = new Basic($options['auth']);
        }

        if ($options['auth'] !== false) {
            $options['auth']->register($options['hooks']);
        }

        if (is_string($options['proxy']) || is_array($options['proxy'])) {
            $options['proxy'] = new Http($options['proxy']);
        }

        if ($options['proxy'] !== false) {
            
Home | Imprint | This part of the site doesn't use cookies.