yii2-bot-telegram icon indicating copy to clipboard operation
yii2-bot-telegram copied to clipboard

file_get_contents("php://input")

Open antongospod opened this issue 4 years ago • 6 comments

hi i am trying to use your dependency in my project but when trying to call Yii :: $ app-> telegram-> sendMessage ([ 'chat_id' => $ chat_id, 'text' => 'test', ]); after which I get a 500 error, because the data from my form goes into your constructor:

public function __construct ($ config = []) {

    parent :: __ construct ($ config);

    $ input = file_get_contents ("php: // input");
    $ array = json_decode ($ input, true);
    $ this-> input = new Input ($ array);

}

namely in $ input = file_get_contents ("php: // input") your script can work fine and error-free without $ input = file_get_contents ("php: // input"); $ array = json_decode ($ input, true); $ this-> input = new Input ($ array);

antongospod avatar Aug 19 '20 13:08 antongospod

Hi I could not handle your error. Please indicate the circumstances in which the error occurs.

akbarjoudi avatar Aug 19 '20 18:08 akbarjoudi

i am trying to use this code: $ res = Yii :: $ app-> telegram-> sendMessage ([ 'chat_id' => $ chat_id, 'text' => 'hello world !!' ]); In my controller, in which a post request sends a notification to mail with data from my form, I wanted to make the notifications arrive in telegram, but the data from my form goes into this piece of code: $ input = file_get_contents ("php: / / input "); in TelegramBase After which I get a 500 error.

antongospod avatar Aug 20 '20 07:08 antongospod

My dear friend, in a part of the explanation, I said that you should get an answer from Telegram enableCsrfValidation Turn off. Probably a problem with this part. https://github.com/akbarjoudi/yii2-bot-telegram#usage-in-controller

akbarjoudi avatar Aug 20 '20 09:08 akbarjoudi

My dear friend, in a part of the explanation, I said that you should get an answer from Telegram enableCsrfValidation Turn off. Probably a problem with this part. https://github.com/akbarjoudi/yii2-bot-telegram#usage-in-controller

No, the problem is that I cant use telegram in my usual controllers.

Vashkatsi avatar Nov 17 '20 12:11 Vashkatsi

hi i am trying to use your dependency in my project but when trying to call Yii :: $ app-> telegram-> sendMessage ([ 'chat_id' => $ chat_id, 'text' => 'test', ]); after which I get a 500 error, because the data from my form goes into your constructor:

public function __construct ($ config = []) {

    parent :: __ construct ($ config);

    $ input = file_get_contents ("php: // input");
    $ array = json_decode ($ input, true);
    $ this-> input = new Input ($ array);

}

namely in $ input = file_get_contents ("php: // input") your script can work fine and error-free without $ input = file_get_contents ("php: // input"); $ array = json_decode ($ input, true); $ this-> input = new Input ($ array);

Сould you solve this problem?

Rafinol avatar Dec 07 '20 10:12 Rafinol

Dear friend @Rafinol I can not see the result of your error and in this case I can not recognize the desired error. Please show me the error that occurs in php.

akbarjoudi avatar Dec 09 '20 18:12 akbarjoudi