I need to find out if a message fits into the 140 character limit of Twitter. This is what I have so far:
$tweetLength = strlen(utf8_decode($_POST["message"]));
if($tweetLength<141){
sendMessage();
}
Links get converted by Twitter into a t.co short URL. How to check how many links are in the message and replace their length with the short-link counterparts?
- a http:// link counts for 22 characters
- a https:// link counts for 23 characters
Links can start with http://www, https://www or www
.