-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Which method is use to send messages? #38
Comments
Good point. I wondered about this a few months ago. @irazasyed - any reason why we use GET requests instead of POST requests when connecting to the telegram server? I had a look and try to change the normal GET to POST in the code, but I wasn't sure how to set the parameters to |
Actually I just worked it out. If we change the This could be refactored, but a quick hack at the moment would look like this: // Api.php
/**
* Send text messages.
*
* @link https://core.telegram.org/bots/api#sendmessage
*
* @param int $chat_id
* @param string $text
* @param bool $disable_web_page_preview
* @param int $reply_to_message_id
* @param string $reply_markup
*
* @return Message
*/
public function sendMessage(
$chat_id,
$text,
$disable_web_page_preview = false,
$reply_to_message_id = null,
$reply_markup = null
) {
$params = compact('chat_id', 'text', 'disable_web_page_preview', 'reply_to_message_id', 'reply_markup');
$response = $this->post('sendMessage', ['form_params' => $params]);
return new Message($response->getDecodedBody());
} |
it seems working , send a Pr |
Please open a new PR and I can merge it. I won't be able to work on this until this month end. So either someone send a PR or please wait. Thanks!! |
#40 Refers |
Hello
i recently had a bug , i suppose this sdk use Get method to send text messaged to telegram api, right ?
when i try to send a big message a message pops up about :
{"\r\n<title>414_Request-URI_Too_Large</title></head>\r\n<body_bgcolor":""white">\r\n
414 Request-URI Too Large</h1></center>\r\n
nginx/1.6.2</center>\r\n</body>\r\n</html>\r\n"}
is there a way to use Post instead of Get ?
The text was updated successfully, but these errors were encountered: