SecretTweet.com is a personal project of mine that revolves around Twitter. It allows Twitter users to input a "tweet" and have it published anonymously to the over 30,000 @SecretTweet followers and hundreds of thousands of visitors to SecretTweet.com. This project has been featured by The New York Times, VentureBeat, The LA Times, el pais, and many other popular news websites. This project was also mention on the Fox News morning program "Fox and Friends" (video here) and was published in the Twitter API book written by Kevin Makice titled Twitter API: Up and Running.
KevinSmithDesigns
From the blog: Pull Attachments from Incoming Mail with Perl
For a new project I've been working on, I needed to pull the image attachments from all incoming mail, store them separately. I couldn't find any snippets online for this so I had to create my own. Here's what I came up with. As always, it's a bit rough but is a [...]
From the blog: Receiving and Sending Text Messages With PHP and IMAP
I've had a lot of requests to turn some of my Twitter apps into mobile services. Most companies, like Twitter itself, use Short Codes (like 40404) to accept and send txt/sms messages. Short codes are very expensive (the cheapest solution I found started at $500 per month for a randomized short code of [...]
From the blog: A design in the works
Just to keep my blog semi updated (seems I'm just letting this place collect dust), here's what I'm working on for today. This design won't be used. I liked where it was going, the client didn't. Figured I'd share it before I toss it. Also, I'm working on something new for this blog. It [...]
From the blog: An Update on the House
After a week or so of very hard work, we decided trying to clean everything up and restore the house was a futile attempt. Everything we really wanted to save/couldn't afford to replace immediately was cleaned up, boxed, and stored at my brother's house. After a couple weeks of cleaning and boxing, the [...]
From the blog: Push RSS feed to your Twitter feed
A friend needed to push/send items from an RSS feed to his Twitter account. Here's the code in a nice .zip file. Very simple and rough, but it gets the job done nicely. Feel free to add to/modify. http://kevinsmithdesigns.com/blog/wp-content/uploads/KSDtwitter.zip
Update: To prevent any confusion the code highlighter might cause in the post, I added a plain text version of this post here.
I noticed a lot of sites allow user submitted content but prevent autolinking of urls. Some of the most common instances of this are on Twitter sites (much like my own creation: SecretTweet.com). So I threw together a function to autolink urls:
<? $text= 'Hey go to google.com moo http://google.com moo www.google.com moo http://wwww.google.com/404.php moo'; function linkify(&$text) { //CONVERT *://.* TO LINK (EG HTTP://KEVINSMITHDESIGNS.COM) $text = ereg_replace("[a-zA-Z]+://([.]?[a-zA-Z0-9_/-])*", "\\0", $text); //CONVERT *://*.* TO LINK (EG HTTP://WWW.KEVINSMITHDESIGNS.COM) $text = ereg_replace("(^| )(www([.]?[a-zA-Z0-9_/-])*)", "\\1\\2", $text); return $text; } echo linkify($text); ?>
Would return "Hey go to google.com moo http://google.com moo www.google.com moo http://wwww.google.com/404.php moo".
And since I made this primarily for Twitter, the following will linke @ replies automatically, too:
<? $tweet = "Hey @mozunk! Go check out http://digsby.com -- I think you will like it."; function twitterify(&$tweet) { //CONVERT *://.* TO LINK (EG HTTP://KEVINSMITHDESIGNS.COM) $tweet = ereg_replace("[a-zA-Z]+://([.]?[a-zA-Z0-9_/-])*", "\\0", $tweet); //CONVERT *://*.* TO LINK (EG HTTP://WWW.KEVINSMITHDESIGNS.COM) $tweet = ereg_replace("(^| )(www([.]?[a-zA-Z0-9_/-])*)", "\\1\\2", $tweet); //LINK @USERNAME $tweet = preg_replace('/([\.|\,|\:|\¡|\¿|\>|\{|\(]?)@{1}(\w*)([\.|\,|\:|\!|\?|\>|\}|\)]?)\s/i', "$1@$2$3 ", $tweet);return $tweet; } echo twitterify(&$tweet); ?>
Would return "Hey @mozunk! Go check out http://digsby.com -- I think you will like it."
I'll be implementing this into SecretTweet pretty soon. I haven't decided if I want to autolink URLs or not...maybe just @replies.
---
automatically link urls php
autolink @ replies Twitter automatically link php