MiLaD GoGoLi
MiLaD GoGoLi

Reputation: 71

PHP ZWNG Character Send to TELEGRAM

Hello everyone i have question from encoding adn telegram

when i send a ZWNG Zero Width space from telegram desktop to my telegrambot like this: IMAGE

it sends this : u200b a json Like this :

 {"update_id":***,
"message":{"message_id":***,"***":{"id":***,"first_name":"***","last_name":"***","username":"***"},"chat":{"id":***,"first_name":"***","last_name":"***","username":"***","type":"***"},"date":***,"text":"u2068"}}

now i wanna send a message like this to my users With telegambot question is here : how to send like this with robots?

i wanna send a ZWNG Zero Width space from telegrambot

Im using this code to send :

$curl = curl_init();
curl_setopt($curl,CURLOPT_URL,"https://api.telegram.org/bot***/SendMessage");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS,
            "chat_id=230307754&parse_mode=Markdown&text=[".urldecode('200b')."](http://google.com)");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$json=curl_exec($curl);
$obj = json_decode($json);

Upvotes: 2

Views: 208

Answers (1)

Saeid Tahmuresi
Saeid Tahmuresi

Reputation: 876

It seems that you want to send some things like "می​شود" with your bot. I recommend to you to use ZWSP (همون نیم فاصله).

You can copy it or use "Ctrl+Shift+2" or "Ctrl+- to insert ZWSP.

for example:

<?php
$chatId = "********";
$botToken = "*********:****************************";
$website = "https://api.telegram.org/bot".$botToken;

sendMessage($chatId, "می​شود");exit;

function sendMessage ($chatId,$message) {
    $url = $GLOBALS[website]."/sendMessage?chat_id=".$chatId."&text=".urlencode($message);
    file_get_contents($url);
}

?>

Upvotes: 1

Related Questions