URL SHORTENER
Tweet

Description

URL Shortener is an easy to use shortener, allowing you to use the domain you want to create short URL's (you must own the domain).

This tool is in active development.
Things planned :

  • Statistics
  • Custom links
  • ...

Use

You must use the Hollywoud API to make your shortening request.

You'll need to call it with the following parameters :

  • action - shorten
  • source - URL or TOKEN
  • domain - DOMAIN (optional, default : hollywoud.net)
  • type - ENCODE ou DECODE (optional, default : ENCODE)
The parameters must be passed as POST to the API (though the GET method also works, it is not recommended).

This page presents an example of a JavaScript call to the shortener, here is a method to do it in PHP with cURL :

$api = 'http://api.hollywoud.net' ;
$action = 'shorten' ;
$domain = 'hollywoud.net' ;
$source = 'http://www.arobase62.fr' ;

$options = http_build_query(array(
    'action' => $action,
    'source' => $source,
    'domain' => $domain
)) ;

$curl = curl_init() ;

curl_setopt_array($curl, array(
    CURLOPT_URL => $api . '?' . $options,
    CURLOPT_HEADER => 0,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_TIMEOUT => 1
)) ;

if(!$result = json_decode(curl_exec($curl))) {
    trigger_error(curl_error($curl)) ;
}
curl_close($curl) ;

$response = $result->response ;

echo $response->result->dest ;

Here is how to redirect your URL :

Create a file .htaccess at the root of your site (the domain you want to use).

Inside of it, add these lines :

RewriteEngine On
RewriteRule ^([0-9a-zA-Z]{2,6})$ http://api.hollywoud.net/?action=redirect&token=$1

And that's all !

Credits

Development : Jerome Meyer