Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
814 stars 343 forks source link

Can't use this libs #113

Closed ibazkom closed 5 years ago

ibazkom commented 7 years ago

I've got this error when I try to use your library:

PHP Parse error: syntax error, unexpected '[' in /vendor/eleirbag89/telegrambotphp/Telegram.php on line 64

Required Information

Expected behaviour

It should be easy to use this library. I just need to send message - plain text message.

Extra details

I install this library with composer method.

Eleirbag89 commented 7 years ago

I guess the problem is the array's square bracket syntax avaible only from php 5.4.

You ca try to change the lines 64 and 65 to

    private $data = array();
    private $updates = array();

and see if it works. In this case i'll add the change in to the main repo.

ibazkom commented 7 years ago

Been try that, but it just lead to another infinite error.

Well, I already can use your libs, and what I do is easily upgrade php on my centos, from 5.3 to 5.6 by following tutorial on this post:

https://stackoverflow.com/questions/21502656/upgrading-php-on-centos-6-5-final

My suggestion is, better change the minimum requirement on libs description, erase the '=' sign.

Great libs anyway, I (still) found no bugs when use it. Very easy to install - when you on the right version of php, and it does what it does. Thank you so much, Keep up the good work!

avaresaneh commented 6 years ago

i am use new telegram.php class new class in cron job cpanel error in line 65 and 65 but correct this solesion but line 95 erro and not use to cron job this class. help me thanks

Eleirbag89 commented 6 years ago

I don't understand your problem. How are you running the cronjob ?