Here you can use http://tuly.in in your irc chat. Just do !url http://site.com. Note: You must include the http:// IT IS VERY IMPORTANT YOU DO!!!
# ALL CREDIT GOES TO HENCO FOR MAKING THE SCRIPT :) #
on *:SockOpen:tuly: {
sockwrite -nt tuly GET $+(/bm.php?url=,%Tuly.url) HTTP/1.1
sockwrite -n tuly Host: www.tuly.in
sockwrite -n tuly $crlf
}
on *:SockRead:tuly: {
var %read | sockRead %read
if (http://* iswm %read) {
.msg %Tuly.chan Shortened URL: %read
unset %Tuly.*
}
}
on *:text:!url *:#: {
set %Tuly.chan $chan
set %Tuly.url $2
sockClose tuly
sockOpen tuly www.tuly.in 80
}
you could do it like this so you can do away with the global vars..
on $*:text:/^@url\s(http\x3A\/\/w{3}\x2E\S+\x2E\S{2,3}?\S+)/iS:#:{
if ($sock(tuly)) sockclose tuly
sockopen tuly www.tuly.in 80
sockmark tuly $+(/bm.php?url=,$regml(1)) msg # Shortened URL:
}
on *:sockopen:tuly: {
sockwrite -n tuly GET $gettok($sock(tuly).mark,1,32) HTTP/1.1
sockwrite -n tuly Host: $+($sock(tuly).addr,$str($crlf,2))
}
on *:sockread:tuly: {
var %tuly | sockRead %tuly
if ($regex(%tuly,/(http:\/\/.+)/)) {
$gettok($sock(tuly).mark,2-,32) $regml(1)
sockclose tuly
}
}
output is the same as the one you posted
Shortened URL: http://tuly.in/lYmBjY
you can also use the post method
on $*:text:/^@tuly\s(http\x3A\/\/w{3}\x2E\S+\x2E\S{2,3}?\S+)/iS:#:{
if ($sock(tuly)) sockclose tuly
sockopen tuly tuly.in 80
sockmark tuly $regml(1) msg # Shortened URL:
}
on *:sockopen:tuly:{
var %tuly $+(url=,$gettok($sock(tuly).mark,1,32),&submit=Shorten)
sockwrite -n tuly POST /process.php HTTP/1.1
sockwrite -n tuly Host: $sock(tuly).addr
sockwrite -n tuly Content-Type: application/x-www-form-urlencoded
sockwrite -n tuly Content-Length: $len(%tuly)
sockwrite -n tuly $+($crlf,%tuly)
}
on *:sockread:tuly: {
var %tuly | sockread %tuly
if ($regex(%tuly,/<.+value='(http.+?)'><\/h2>/)) {
$gettok($sock(tuly).mark,2-,32) $regml(1)
}
}
the output looks like this
Shortened URL: http://tuly.in/lLwNaW
Is that ur site?, cuz that mirc socket is on http://api.tuly.in/
anyways nice lil site