or like this https://t.me/RoobaiOfficaial/2032
i am new to coding and unable to get bot to working any help will be appreciated
code how i upload image and set chat id
<form method="post" enctype="multipart/form-data">
<input type="text" name="chat_id" value="" />
<input type="url" name="photo" value="" />
<input type="submit" name="send" action="<?php echo $website.'/sendPhoto'?>"/>
</form>
and i add message and create 1 inline button which contains url
<?php
$msg= urlencode("test message");
$token="bot_token";
$chatId="chat_id";
$response=($_POST['photo']);
$response=$response.urldecode($msg);
$keyboard = [
'inline_keyboard' => [
[
['text' => 'Buy Now', 'url' => 'https://i.sstatic.net/vLHu9.png']
]
]
];
$encodedKeyboard = json_encode($keyboard);
$parameters =
array(
'chat_id' => $chatId,
'text' => $response,
'reply_markup' => $encodedKeyboard
);
send('sendMessage', $parameters); // function description Below
function send($method, $data)
{
$url = "https://api.telegram.org/".$token. "/" . $method;
if (!$curld = curl_init()) {
exit;
}
curl_setopt($curld, CURLOPT_POST, true);
curl_setopt($curld, CURLOPT_POSTFIELDS, $data);
curl_setopt($curld, CURLOPT_URL, $url);
curl_setopt($curld, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($curld);
curl_close($curld);
return $output;
}
i m getting this type of response but i need it without link Response
Try updating these 2 lines:
send('sendMessage', $parameters); // function description Below
function send($method, $data)
to include $token
send('sendMessage', $parameters, $token); // function description Below
function send($method, $data, $token)
This link explains why its probably not working the way you expect it to. http://php.net/manual/en/language.variables.scope.php