nav.gif Home » Snippets » is.gd URL Shortener

ammenul.gif
ammenur.gif
Please Register/Login to enhance your access of our site and services. We support Twitter and Facebook logins. Logging in will reduce the amount of advertisments.
ammenul.gif
ammenur.gif


ammenutopl.gif
TG007 Snippet
ammenutopr.gif
is.gd URL Shortener
Category: General IRC

About
My first time using sockets. Used to shorten urls using is.gd
Credit Swiftirc forums for the socket tutorial I followed.


alias shorten {
  if (sock(isgd)) {
    sockclose isgd
    sockopen isgd is.gd 80
    set %isgd $$1
  }
  else {
    sockopen isgd is.gd 80
    set %isgd $$1
  }
}
on *:sockopen:isgd:{
  sockwrite -nt $sockname GET /api.php?longurl= $+ %isgd HTTP/1.1
  sockwrite -nt $sockname Host: is.gd
  sockwrite -nt $sockname $crlf
}
on *:sockread:isgd:{
  sockread %temp
  if (http://is.gd/* iswm %temp) {
    echo -a Shortened URL: %temp
  }
}
menu Menubar {
  Shorten URL: /shorten $$?="URL to Shorten?"
}


Comments

err0r Posted on: 12/19/10
avatarnice snippet

sugarboy Posted on: 12/19/10
avatarThank you err0r. This was my very first try with sockets. I have searched for something like it in the pass, but never found anything. So I figured it would be something to try for my first attempt. Actually quite proud of myself. ^__^

Fanfare Posted on: 1/8/11
avatar
if (sock(isgd)) {
sockclose isgd
}
sockopen isgd is.gd 80
set %isgd $$1
}
}
No else condition is needed.

var %temp
sockread %temp
So that you don't have the data set as a global var in your variable.

Sorry you must register and log-in to post comments
ammenul.gif
ammenur.gif
ammenutopl.gif
Info
ammenutopr.gif
Snippet Information
Creator:sugarboy
Date Added:12/18/10
Last Updated:12/18/10
Tags:url is.gd shortener
Problem?Report Snippet
ammenul.gif
ammenur.gif



15 user(s) currently browsing site (0 members, 15 guests, 0 anonymous)
No Members Logged In

11 Users in IRCommunity
inføвøт, err0r, ●fiestýβสbỳ●, båbyġurł, DennieWennie™, Erroneous, payback, TOP™, ﴾Ɣ﴿ⓨⓢⓣⓘⓒ★§ⓟⓔⓛⓛ, danger , extremity



lhfooter.gif
TechDesigns007.com | Valid XHTML 1.0 | Valid CSS | Load Time: 0.00 sec(s)
rfooter.gif


Latest Alert: 10.14.2011 mIRC 7.22 released
oldline
oldline
oldline
oldline