public function setWebhook($url, $certificate = null)
{
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new TelegramException('Invalid URL provided');
}
if (parse_url($url, PHP_URL_SCHEME) !== 'https') {
throw new TelegramException('Invalid URL, it should be a HTTPS url.');
}
if (is_null($certificate)) {
return $this->sendRequest('setWebhook', compact('url', 'certificate'));
} else {
return $this->uploadFile('setWebhook', compact('url', 'certificate'));
}
}