-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to pass on parameters to ReactPHP's HTTP Client. Closes #72
- Loading branch information
Showing
2 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
include __DIR__.'/basics.php'; | ||
|
||
use \React\EventLoop\Factory; | ||
use \unreal4u\TelegramAPI\HttpClientRequestHandler; | ||
use \unreal4u\TelegramAPI\TgLog; | ||
use \unreal4u\TelegramAPI\Telegram\Methods\SendMessage; | ||
|
||
$loop = Factory::create(); | ||
// Passing along an array with options will allow you to choose a custom DNS that isn't 8.8.8.8 | ||
$tgLog = new TgLog(BOT_TOKEN, new HttpClientRequestHandler($loop, ['dns' => '8.8.4.4'])); | ||
|
||
$sendMessage = new SendMessage(); | ||
$sendMessage->chat_id = A_USER_CHAT_ID; | ||
$sendMessage->text = 'Hello world!'; | ||
|
||
$tgLog->performApiRequest($sendMessage); | ||
$loop->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters