Русская версия English version

API

API of short URL service RLU.ru is very simple. You need to make a GET-request in order to use it:

http://rlu.ru/index.sema?a=api&del=10&preview=1&link=http%3A%2F%2Fgoogle.com

The request parameters mean the following:

Required parameters which must be in every request: a=api and link=[long URL].

If you send correct request, you receive short URL like:

http://rlu.ru/1a2b3

If you send wrong request (for example, long URL is missing), you receive the error description (in UTF8 encoding). It always starts with «Error». For example:

Error: Long URL is incorrect.

PHP example:

<?php
$res=file_get_contents('http://rlu.ru/index.sema?a=api&link='.urlencode('http://google.com'));
$pos=strpos($res,'Error: ');
if ($res=='' || $pos!==false && $pos==0) echo 'The error is occurred. '.$res;
else echo 'Short URL: '.$res;
?>

Perl example:

#!/usr/bin/perl
use LWP::UserAgent;
use URI::Escape
my $ua = LWP::UserAgent->new;
my $response=$ua->get('http://rlu.ru/index.sema?a=api&link='.uri_escape('http://google.com'));
my $res=$response->content;
if ($res eq '' || $res=~/^Error: /) { print 'The error is occurred. '.$res; }
else { print 'Short URL: '.$res; }

Attention! If you send a lot of requests from one IP, it can be blocked. If you plan to add more then 100 URLs in one hour, please let the technical support know. Otherwise your IP can be blocked unexpectedly. Prior added URLs can be deleted.

Uptime