Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A Perl script to create Tiny URLs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A Perl script to create Tiny URLs
Authored by: natebeaty on Feb 22, '07 10:39:47AM

Here's a modification of the Ruby script above for urlx (formatted as a TextMate command, replace ENV["TM_SELECTED_TEXT"] with ARGV[0] and print with puts for a shell command..)


#!/usr/bin/env ruby
require 'net/http'
require 'uri'

in_url = ENV["TM_SELECTED_TEXT"]
url = URI.parse('http://urlx.org')
res = Net::HTTP.start(url.host, url.port) {|http|
  http.get("/api.php?x=#{in_url}")
}
print res.body


[ Reply to This | # ]