Some time ago I’ve wanted to post excerpt from the book I was reading on Safari Books Online on my Facebook wall. Everyone who have ever used Safari knew that their books are displayed in special way, so you can only use their applet to copy text (probably they’ve done that to avoid people copying entire books). As a result you’ll obtain text which would reside in your clipboard. To publish it on Facebook you need just to paste it into appropriate field and…
Yes, Facebook limits text to be posted to 420 characters, so if you want to post something longer you need to find other way. And that’s how Text Hoster was born. It’s web application written by me to host text which can then be posted to Facebook. When you’ll go to fb.liox.eu you’ll find a field to enter your text and Send button, I believe it’s self explanatory. When you’ll click Send simple check is done to calculate length of your string, so if it’s less than 420 characters then it would not be hosted as there is no reason for it. Then you’ll see a page with your text, full link to your text, bit.ly shortened link and Facebook share button. After clicking Share you’ll be navigated to page as the one below.
It’s typical representation of Facebook generated link, as you can see there is shortened version of the text and bit.ly link, you can also add short description to it. Now click share again and voila your text is on your Facebook wall (of course you should be logged before sharing or you’ll be asked to log in), when somebody would click on it he would be navigated to hoster page and able to read full text.
Now let me say a little about project itself. It’s written in PHP and all data is kept in MySQL DB. It was great opportunity to learn new things, so I’m happy that I’ve done it, but I know that there are probably better ways to do the same. My wife says it’s waste of time as you can simply make a screenshot, publish it somewhere and post a link to it on FB, I love to receive support from my spouse. But no chance of learning something new is ever waste of time and if you’ll post image you would block ability to copy your text to your readers (which is not always so bad). Anyway in current shape it’s exactly what I’ve wanted it to be. Light, simple to use and creates descriptive Facebook posts. This took me some time as when I’ve written the app posts generated by it contained text from the app itself, not shortened version of hosted text. But I’ve studied FB documentation and found out that you need to specify two meta tags:
And fill them with information you want to be part of FB link. So I’ve created simple formula to do that. I could probably go without using bit.ly to shorten links, but I find them looking better than the long ones and it should be useful when sharing text outside FB, for instance via IM.
At the end I would like to say that this project has been created just for learning purposes and to help people who would want to post long text to Facebook. That’s why I’m not taking responsibility for texts hosted in my apps (as I’m not able to control that) and reserve the right to close it down and swipe DB if it would be abused. If you have any proposition of improvement, want to report abuse or bug, or just want to say something about this app please do so by commenting this post.
UPDATE1: I’m escaping special characters to prevent SQL injection, so instead of ‘ you’ll see \‘.
I hope I would figure out something better soon. Haha! I’ve solved it! I couldn’t go to sleep knowing that my “baby” is not acting as it should:) Now you can enjoy your text being displayed in exact way you’ve provided it.
Must figure out how to maintain correct alignment of text, so it would display exactly how you’ve formatted it, not in one line as it’s now. But that needs to wait, I’m tired, goodnight. Done. Now you can enjoy beauty of line breaks thanks to nl2br command. I’ve also added auto select function to link fields. Enjoy!
UPDATE3: I’ve finally implemented what should be operational from the start, displaying instead of interpreting HTML code. I know, it was very lame that I haven’t thought about it earlier. I hope that nobody got harmed because of that.
UPDATE5: Now Arabic texts are being displayed as they should, right to left. Thanks to regular expressions a little automation was possible here.
UPDATE6: Added Tweet button and email address where you can report abuse.