Skip to content
A simple API Wrapper for the ecilA Link Shortener API
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
api.class.php

README.md

ecilA API PHP Wrapper

A simple API Wrapper for the ecilA Link Shortener API, written in PHP.
By Alice Peters

Basic usage:

include 'api.class.php';
$api		=	new  ecilaAPI('YourUsername',  'YourApiKey');
$request	=	$api->actionToPerform('Action');

You need an API key to be able to use the API. You can generate a new API key on your settings page.

Available actions:

Get data of an existing link:

$api->getLinkData('a1ic3');
// Or a custom link:
$api->getLinkData('l/a1ic3');

Example output:

array(2) { 
	["success"]=> 1 // 0 if an error ocurred
	["data"]=> { 
		["url"]=> "https://domain.tld/" // Original / target url
		["link"]=> "a1ic3" // Short link key
		["expire"]=> "0" // Expiration time in hours
		["time"]=> "1525987497" // Gets updated when the expiration time is set
		["timestamp"]=> "2018-05-10 23:24:57" // Creation date of the link
		["reported"]=> "0" // How many times the link was reported
		["moderated"]=> "0" // 1 if the link was previously approved by a moderator
		["private"]=> "0" // 1 if the link is not allowed to be displayed at the front page
	}
}

Add a new link:

$api->addLink('https://domain.tld/link-to-shorten/');

Example output:

array(2) { 
	["success"]=> 1 // 0 if an error ocurred
	["data"]=> { 
		["link"]=> "a1ic3" // Short link key (https://ecila.ga/a1ic3) 
		["code"]=> "Some simple code appears here" // Deletion code used to delete this short link later on
	}
}

Delete an existing link

$api->deleteLink('A deletion code that was returned by ecilaAPI::addLink();');

Example output:

array(1) {
	["success"]=> 1 // 0 if an error ocurred
}

Example error:

array(2) {
	["success"]=> 0
	["error"]=> "Some funny error message that tells you exactly what went wrong."
}

View ecila.ga

You can’t perform that action at this time.