Inserting emoji in tweet and message from php


All I want is to insert emoji in a tweet or in a message from a php script. The problem is that I can’t understand how I should encode the unicode character.

I found the emoji codes here:
I know that the text must be UTF-8 encoded and I already know how to send a normal tweet or message, but I just don’t understand how to append an emoji.
Maybe it’s just a little thing…

Thanks in advance!


Don’t use php - but this looks like it: so "\u{1F63A}" for :smiley_cat: emoji etc.


Hi, thanks for the help!
Maybe that should work on php 7 but I’ve php 5.6 and for me it doesn’t work.

I’ve tried this:
echo html_entity_decode('😉', 0, 'UTF-8');
and I could see the winking face on the browser

so i tried to append that to the text that will be sent to the API:
$TEXT="@twitterapi trying to tweet an emoji from php script: "; $TEXT=utf8_encode($TEXT).html_entity_decode('😉', 0, 'UTF-8');

And i got this:

So I solved it and i hope that it will be helpful for somebody else too! :wink: :wink: :wink: