$url, 'http_accept' => 'text/*', 'type' => 'text/html', 'timeout' => $this->timeout, ]; // Site configs routinely set a user-agent to get the article rather than a // consent wall; UrlHelper takes it as a first-class option. if (isset($headers['user-agent'])) $options['useragent'] = $headers['user-agent']; $body = \UrlHelper::fetch($options); if (!is_string($body) || $body === '') { $error = \UrlHelper::$fetch_last_error ?: 'fetch returned nothing'; return new FetchResult(error: $error, status: (int) \UrlHelper::$fetch_last_error_code); } return new FetchResult( html: $body, effective_url: \UrlHelper::$fetch_effective_url ?: $url, status: 200, ); } }