Longman\TelegramBot\Request::setWebhook PHP Method

setWebhook() public static method

Set webhook
public static setWebhook ( string $url = '', string $file = null ) : ServerResponse
$url string
$file string
return Longman\TelegramBot\Entities\ServerResponse
    public static function setWebhook($url = '', $file = null)
    {
        $data = ['url' => $url];
        self::assignEncodedFile($data, 'certificate', $file);
        return self::send('setWebhook', $data);
    }

Usage Example

Beispiel #1
0
 /**
  * Set Webhook for bot
  *
  * @return string
  */
 public function setWebHook($url)
 {
     if (empty($url)) {
         throw new TelegramException('Hook url is empty!');
     }
     $result = Request::setWebhook($url);
     if (!$result['ok']) {
         throw new TelegramException('Webhook was not set! Error: ' . $result['description']);
     }
     return $result['description'];
 }
All Usage Examples Of Longman\TelegramBot\Request::setWebhook