This repository was archived by the owner on Sep 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ include __DIR__ . '/basics.php ' ;
6+
7+ use React \EventLoop \Factory ;
8+ use unreal4u \TelegramAPI \HttpClientRequestHandler ;
9+ use unreal4u \TelegramAPI \Telegram \Methods \SendContact ;
10+ use unreal4u \TelegramAPI \TgLog ;
11+
12+ $ loop = Factory::create ();
13+ $ tgLog = new TgLog (BOT_TOKEN , new HttpClientRequestHandler ($ loop ));
14+
15+ $ sendInvoice = new SendContact ();
16+ $ sendInvoice ->chat_id = A_USER_CHAT_ID ;
17+ $ sendInvoice ->phone_number = '+420123456789 ' ;
18+ $ sendInvoice ->first_name = 'Tomas ' ;
19+ $ sendInvoice ->last_name = 'Palider ' ;
20+ $ sendInvoice ->vcard = 'BEGIN:VCARD
21+ VERSION:3.0
22+ EMAIL;TYPE=INTERNET:[email protected] 23+ END:VCARD ' ;
24+
25+ $ promise = $ tgLog ->performApiRequest ($ sendInvoice );
26+
27+ $ promise ->then (
28+ function ($ response ) {
29+ echo '<pre> ' ;
30+ var_dump ($ response );
31+ echo '</pre> ' ;
32+ },
33+ function (\Exception $ exception ) {
34+ // Onoes, an exception occurred...
35+ echo 'Exception ' . get_class ($ exception ) . ' caught, message: ' . $ exception ->getMessage ();
36+ }
37+ );
38+
39+ $ loop ->run ();
You can’t perform that action at this time.
0 commit comments