# Monday, September 07, 2009
Monday, September 07, 2009 7:56:12 PM (Pacific Standard Time, UTC-08:00) ( c# )

Using the api of TinyUrl is really simple, here's how:

string uriToCompress = "http://blog.esponjasoft.com/2008/08/28/RealSimpleBackup.aspx";
string tinyUrlAPIFormat = "http://tinyurl.com/api-create.php?url={0}";
string requestUri = string.Format(tinyUrlAPIFormat, uriToCompress);
HttpWebRequest request = WebRequest.Create(requestUri) as HttpWebRequest;
HttpWebResponse response = null;
Uri responseUri = null;
try
{
    response = request.GetResponse() as HttpWebResponse;
    StreamReader sr = new StreamReader(response.GetResponseStream());
    responseUri = new Uri(sr.ReadToEnd());
}
catch (Exception ex)
{
    //handle exception
}

Console.WriteLine("Compressed uri: {0}", responseUri);

- Ramiro Berrelleza

Your Host

Your host, Ramiro Berrelleza

Ramiro Berrelleza on Twitter del.icio.us Send mail to the author(s)

Tags

animation (2) backup (1) c# (4) graphics (1) office (1) outlook (1) quicktips (1) robocopy (1) silverlight (3)

Archive

Blogroll

Feed

RSS 2.0