Skip to content

Instantly share code, notes, and snippets.

@seanho
Created February 5, 2010 01:26
Show Gist options
  • Select an option

  • Save seanho/295369 to your computer and use it in GitHub Desktop.

Select an option

Save seanho/295369 to your computer and use it in GitHub Desktop.
NSString *url = @"http://brandontreb.com";
NSString *apiEndpoint = [NSString stringWithFormat:@"http://api.tr.im/v1/trim_simple?url=%@",url];
NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:apiEndpoint]
encoding:NSASCIIStringEncoding
error:nil];
NSLog(@"Long: %@ - Short: %@",url,shortURL);
// Outputs Long: http://brandontreb.com - Short: http://tr.im/MRDd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment