php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.87k stars 951 forks source link

Catchable fatal error - could not be converted to string #31

Closed weiddolo closed 9 years ago

weiddolo commented 9 years ago

I've cloned and upload on my host the LAST VERSION (packagist v0.17.0), but if i run example-set.php on a host with php 5.4 and i will get this error: Catchable fatal error: Object of class Longman\TelegramBot\Entities\ServerResponse could not be converted to string in /var/www/vhosts/XXXXXXXXXXX/XXXXXXXXXX/weiddolo/set.php on line 16

weiddolo commented 9 years ago

anyone can help me?

sanok commented 9 years ago

You can try to set the Webhook manually using an url formed as this

https://api.telegram.org/bot12345:ABCDEFGHIJKL/setWebhook?url=https://yourdomain.com/path_to_bot_directory/hook.php

12345:ABCDEFGHIJKL is the token that FatherBot has created for your bot

weiddolo commented 9 years ago

After i have set manually the webhook, how do I check that the ALL works properly?

sanok commented 9 years ago

Using the telegram app, open a chat with your bot. After that, send the /help command, and you must see response and also something in botname.log and mysql database if enabled. If not, check your server logs.

weiddolo commented 9 years ago

The log file is not created. I have not set the bot with mysql, but I have enabled the log file in the setting in hook.php.

MBoretto commented 9 years ago

I've fix the error with setWebhook in 0.17.1 let me know if you still have problems.

sanok commented 9 years ago

Weiddolo if the file it's not created, check that your web server has granted permissions to write on the folder, if not, you can create the file and change ownership (I'm assuming that you are using an OS that this considerations matters)

weiddolo commented 9 years ago

@MBoretto now Webhook was set! Now i have typed in a chat: /echo Hello! but the bot doesnt reply :D The log file was created but is empty!

@sanok Thanks for your help, i have also checked the folder permissions.

WISTFUL12 commented 9 years ago

When I use Webhook Method and visit set.php, I get "Webhook was set" but: The bot doesn't reply The log file is empty

I have server with self-signed certificate. I don't know how can I upload my public key certificate according https://core.telegram.org/bots/api#setwebhook method.

When I use getUpdate Method and run "while true; do ./getUpdatesCLI.php; done", I get below error on my error log: [17-Sep-2015 10:12:08] PHP Catchable fatal error: Object of class Longman\TelegramBot\Entities\ServerResponse could not be converted to string in /home/_/_.com/php-telegram-bot-master/vendor/longman/telegram-bot/src/Request.php on line 80

weiddolo commented 9 years ago

@WISTFUL12 have you update with 0.17.1 versions?

WISTFUL12 commented 9 years ago

Yes. I have installed fresh version on yesterday...

MBoretto commented 9 years ago

Try to disable logging i verified that it cause some problems

weiddolo commented 9 years ago

@MBoretto How i can resolve the "2015-09-17 17:35:54 - Fail fetch updates"?

MBoretto commented 9 years ago

Are you under Windows?

weiddolo commented 9 years ago

Dedicated Server Linux - Aruba. MySQL is empty and the bot doesn't reply. I have DISABLED privacy

WISTFUL12 commented 9 years ago

@MBoretto :+1: https://github.com/akalongman/php-telegram-bot/issues/35#issuecomment-141195216