1-Click TinyUrl + Twitter

10 March 2008 | 5 Comments

so me friends @ashafrir and @jeffpulver got me onto twitter a few weeks ago. it’s not hard to notice that everyone and his sister are using tinyurl to, well, tinyurl. the task is tedious (if you’re as lazy as i am) you really want these things to take 1-click.

10 minutes of searching and 10 minutes of hacking later, zvitz (sorta hebrew for twitt) is born. just drag it to your toolbar, and whenever you are on a page you would like to twit about, hit the bookmarklet, and you will find yourself in twitter, with your status already containing a tinyurl of the page you were looking at.

here’s the formatted source for the bookmarklet:
javascript:
(function(){
var z=open().document;
z.location=”http://ohadpr.com/zvitz.php?url=”+document.location;
z.close();
}
)()
and here’s the PHP backend to support it:
$f = @fopen(‘http://tinyurl.com/api-create.php?url=’ . $_GET['url'], ‘r’) or header(“Location: sorry zvit or tinyurl not working”);
$tinyUrl = fgets($f, 8192);
fclose($f);
header(“Location: http://twitter.com/home?status=$tinyUrl”);
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Current
  • E-mail this story to a friend!
  • FriendFeed
  • HackerNews
  • LinkedIn
  • Netvibes
  • Ping.fm
  • Reddit
  • StumbleUpon
  • Twitter
  • Yahoo! Bookmarks

5 Responses on “1-Click TinyUrl + Twitter”

  1. Yosi Taguri says:

    You are simply too smart!

  2. Fred Tsa says:

    You should do the same thing for XR.com — it’s way shorter than tinyurl and has an api.

    http://apicode.xr.com/

  3. grigory says:

    Hi!

    I’ve created couple of bookmarklets as well for twitter – to use is.gd and tinyurl services. They don’t require users to have any backend, so people can just drag them to their bookmark tabs and start using them.
    Check them out: http://gricode.tumblr.com/post/75525339/twitter-is-gd-bookmarklet

  4. grigory says:

    The above link also contains a link to a small API I wrote for is.gd, jsonp wrapper for it. Might be something useful for you :)

  5. I enjoyed reading this – very informative and useful information without a bunch of BS!

Leave a Reply