PHP telegram bot reply_mark -


i'm programming bot on telegram , didn't make special keyboard via reply_mark can me? code this:

file_get_contents($website."/sendmessage?chat_id=".$myid."&text=keytest&reply_markup={"keyboard":[["test"]]}"); 

if copy&paste parameters bot , execute command works. that's because use text provide parts of url.

api.telegram.org/bot[key]/sendmessage?chat_id=[id]&text=keytest&reply_markup={"keyboard":[["test"]]} 

what doing writing script executes command. far can tell you're using dot . concatenate strings. thing you're doing trying write json reply_markup directly url.

what problem is, 1 of following: you're not escaping " sign or not concatenating variables correctly.

so if keyboard , test variables need concatenate them correctly using dot:

file_get_contents($website."/sendmessage?chat_id=".$myid."&text=keytest&reply_markup={".$keyboard.":[[".$test."]]}"); 

but if want write test keyboard string need escape " string not end:

file_get_contents($website."/sendmessage?chat_id=".$myid."&text=keytest&reply_markup={\"keyboard\":[[\"test\"]]}"); 

note: have no idea if correct way escape " in php. explain error. if need escape double quotes in php other way, how supposed be.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -