General['api_service_url']; $url .= '/1.0/subscribeNewsletter/'; $params = array( 'email' => $email, 'piwikorg' => (int)$matomoOrg, 'piwikpro' => (int)$professionalServices, 'url' => Url::getCurrentUrlWithoutQueryString(), 'language' => StaticContainer::get('Piwik\Translation\Translator')->getCurrentLanguage(), ); $url .= '?' . Http::buildQuery($params); try { Http::sendHttpRequest($url, $timeout = 2); $optionKey = self::NEWSLETTER_SIGNUP_OPTION . $userLogin; Option::set($optionKey, 1); return true; } catch (Exception $e) { return false; } } }