mIRC URL Shortener using ou.gd

By TimRoden on Mar 10, 2011

A simple URL shortener using the ou.gd service

on *:TEXT:!ougd *:#: {
  sockClose ougd
  %ougd.url = $2
  %ougd.chan = $chan
  SockOpen ougd ou.gd 80
}
on *:SockOpen:ougd: {
  sockwrite -nt ougd GET $+(/api.php?format=simple&action=shorturl&url=,%ougd.url) PHP/5.3.3-7
  sockwrite -n ougd Host: ou.gd
  sockwrite -n ougd $crlf
}
on *:SockRead:ougd: {
  var %ougd.read
  sockRead -nf 20 %ougd.read
  ;echo 9 -ta %ougd.read
  if (http://* iswm %ougd.read) {
    msg %ougd.chan Shortened URL: %ougd.read
    echo 9 -ta Shortened URL: %ougd.read
    unset %ougd.*
  }
}

Comments

Sign in to comment.
Jethro   -  Mar 10, 2011

That website's default support is the POST method, but you've used the GET...which in turn will work as well. :p

One thing you should be aware of is that if $2 is not a URL but something else, it may trigger the script to set the variables. You may need to make sure the $2 is a link.

You're encouraged to check up on the command /sockmark and the identifier $sock().mark so you don't have to set variables to be referenced.

Other than that, nice exertion you've made into this socket script.

 Respond  
Sorasyn   -  Mar 10, 2011

I spy some test code. ;] Might wanna clean it up; otherwise looks good.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.