The Artima Developer Community
Sponsored Link

Agile Buzz Forum
TinyUrl Interface

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
TinyUrl Interface Posted: Apr 4, 2009 5:58 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: TinyUrl Interface
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

I do enough things with Smalltalk and social media sites like Twitter that I thought having a little service interface to TinyUrl would be useful. So, I created one. Very simple usage model:


TinyUrl.Shortener shorten: 'someLongUrlStringHere'

The code is in the public repository, in package TinyUrlInterface. The guts of it are short enough that the package almost isn't worth it, but I use this kind of thing a fair amount:


client := HttpClient new.
response := client 
	post: 'http://tinyurl.com/create.php' 
	formData: (Array with: 'url' -> 'http://www.longUrlHere.com').
stream := response contents asString readStream.
stream upToAll: '<blockquote><b>http://tinyurl'.
stream throughAll: 'b>'.
tinyUrl := stream upTo: $<.

Pretty basic stuff, but I thought it might be useful for anyone doing Http interface work in Cincom Smalltalk :)

Technorati Tags: ,

Read: TinyUrl Interface

Topic: Reflecting at the Fun Day Previous Topic   Next Topic Topic: Skip the last episode of Life on Mars

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use