----------------------------------------------------------------------
Smaller URL v0.03 -- By TBF.
----------------------------------------------------------------------

Usage:
-
/s.url http://www.example.org/

-
Purpose:
-
Uses the Metamark service to form alternative, possibly, smaller
URLs, which can then be used as its replacement - suitable for
pasting in IRC channels, MSN clients, Emails, etc.

This allows the safe usage of very long URLs without leading
to possible truncations occuring by the original URLs length,
not to mention they are slightly easier to remember :>.

-
Examples:
-
Lets say you wish to inform a friend of the following URL:

http://www.fourmilab.ch/cgi-bin/uncgi/Earth?imgsize=1024&opt=-l&lat=
52.7917&ns=North&lon=38.5833&ew=West&alt=149151162&img=learth.evif
(wrapped for readability).

Due to the overly long URL, your message would most likely truncate
the address, and lead to a messy conversation trying to inform them
how to access the URL, this is where s.url comes in, you supply the
above URL to it and it will return a much smaller URL using the
Metamark service.

In the example case, this would return 'http://xrl.us/ngs', which I
feel is much easier to state and use. You simply use that URL in
place of your original one, when someone accesses 'http://xrl.us/ngs',
they are automatically forwarded to your intended URL.

A few example URLs transformed by s.url (some wrapped for readability):

Input:
http://www.google.com/search?q=Programming+Perl+DBI&sourceid=opera&
num=25&ie=utf-8&oe=utf-8

Output:
http://xrl.us/nnx

Input:
http://www.amazon.com/exec/obidos/tg/detail/-/1565926994/qid=105956
9173/sr=8-1/ref=sr_8_1/102-9231467-5340135?v=glance&s=books

Output:
http://xrl.us/nny

Input:
http://www.activestate.com/Products/ActivePerl/

Output:
http://xrl.us/nn2

-
Notes:
-
This is a mIRC script, and therefore will only function via that
client software. To load it up, save an instance of this script in
your mIRC base directory, such as 'c:\mirc\', and in your client,
issue the following command to load the script:

/load -rs s.url.mrc

mIRC will react by showing a informational message, similar to
'* Loaded script 'c:\mirc\s.url.mrc'', if this is not the case,
you may need to state the correct location of the script (in
the /load command) and retry again. If you need additional
information, issue '/help load' in your client.

This script caches URLs in a effort to increase its reaction time,
and to lower the amount of connections made to the Metamark service.

URLs are cached in a file titled 's.url.db', which is located the same
directory where s.url exists in. You may view the contents of the cache
by using the following command in mIRC: /s.url.cache

The script will try its best to predict common errors before
attempting to parse the Web page returned by the service, errors
are stated and if possible, along with code numbers.

Before asking me (or others) on what the error codes indicate,
read below for explanations on the most common ones:

0: You may not have a active or accessible (via mIRC sockets) Internet
connection, the DNS for the Metamark service is unavailable, or similar.

10053: You may have lost Internet accessibility while s.url was
connecting, sending, or receiving data from the Metamark service, and
therefore your machine aborted access to the socket.

10054: The Metamark service may have lost the connection to your
machine, or was rebooted, also see the details stated for error 10053.

10057: The socket which the script was using to interact with the
Metamark service has been disconnected and it was not informed of this,
thus outputting errors when writing to the socket.

10060: The Metamark service did not respond back in a timely manner
when s.url attempted to connect to it, also see the details stated for
error 0.

10061: The Metamark service, or a linked machine, actively refused to
allow your machine to connect. Occasionally, this may mean the service
is not available (no port open on remote side).

10065: No route could be fetched for the Metamark service host and
therefore it is unreachable.

* Most of these errors are commonly caused by a firewall, use
google.com if you need to find possible solutions to these common
errors.

-
Version History:
-
28th July 2003:
Developed basic version - awaiting new ideas for future versions.

30th July 2003:
Documentation ported from source code to readme.txt file, cleaned and
reworded a few paragraphs, added mIRC script '/load' section and fixed
some minor grammar mistakes.

19 August 2003:
Ask Bjrn Hansen <http://xrl.us/z5> (MetaMark developer) recommended
I use REST API for this script instead of sending POST data to
www.metamark.net/add, and so this script now uses REST API,
resulting in less bandwidth being consumed to fetch URLs.

Rich_NL <http://xrl.us/pyj> recommended $base() for the URL encoding,
which now means I have slightly cleaner code :). View http://xrl.us/n29
for his original comments.

12th September 2003:
Added basic cache system to the script in a effort to minimise the need
to query metamark.net for results to commonly requested URLs.

-
Contact:
-
If you wish to pass me comments, suggestions, bugs, or a feature
request on this script, then use the following methods:

Email: $+(tbf, $chr(64), new-frontier.org).
IRC: TBF / TBlueF on EFNet (www.efnet.org).

12th August 2003.

- EOF.