php - Telegram API encode message to be sent
What is the encode parameters url of telegram? I usedurlencode ($message)
but on mobile the message is not decoded from the app. **If I don't use the encode for the message , I get an error
gateway (error 501 or 502**, I don't remember)
.
The example url is that I dohttps://api.telegram.org/bot$token/sendMessage?chat_id=$chat_id&text=$message
where$message
is my text to be decoded
Answer
Solution:
just make an array and use
http_build_query
method. It also handles the encoding for you.An example would be like this:
I'm using this exact way in my micro Telegram bot app here.