telegramBot::setWebhook PHP Method

setWebhook() public method

Set a Webhook to receive incoming updates via an outgoing webhook.
public setWebhook ( string $url, $certificate = null ) : Array
$url string HTTPS url to send updates to. Use an empty string to remove webhook integration
return Array
    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'));
        }
    }