setup_handle example

 else {
                throw InvalidArgument::create(3, '$data', 'array|string', gettype($data));
            }
        }

        if (is_array($options) === false) {
            throw InvalidArgument::create(4, '$options', 'array', gettype($options));
        }

        $this->hooks = $options['hooks'];

        $this->setup_handle($url$headers$data$options);

        $options['hooks']->dispatch('curl.before_send', [&$this->handle]);

        if ($options['filename'] !== false) {
            // phpcs:ignore WordPress.PHP.NoSilencedErrors -- Silenced the PHP native warning in favour of throwing an exception.             $this->stream_handle = @fopen($options['filename'], 'wb');
            if ($this->stream_handle === false) {
                $error = error_get_last();
                throw new Exception($error['message'], 'fopen');
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.