Show DevBest Shortening URLs with the FFS.Im public API

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
I have recently thought of a new project, which is simply a URL shortener, but I plan to add more feature to its API in the future. The website is called FFS (wanted to make it catchy and easy to remember.)

Here's a simple PHP example on how to use the API
PHP:
function shorten($url) {
  $call = file_get_contents('http://api.ffs.im/?url=' . $url);
  $call = json_decode($call, true);
  if( $call['result'] !== 0 ) {
    return $call['result'];
  } else {
    return false;
  }
}
The documentation for the API can be found .
I wrote the code on my mobile so it might have errors. Please tell me if it does, thanks.
 
Last edited:

PousseyWashington

why did I buy an upgrade
Apr 29, 2014
31
12
Here's a for API usage, if anyone's interested.

You should make a repo for this site; I would love to build upon it. Good luck!
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
I'm going to release the site on GitHub when I have successfullly converted everything into Javascript, so it will 100% PHP-less. I will not release the API on GitHub.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Using jQuery
HTML:
function shorten(url){
        $.ajax({
            url: "http://api.ffs.im/?url=" + url,
            type: "GET",
            success: function(d){
                if(d.result != 0){
                    console.log(d.result);
                }else{
                    //Handle the error
                }
            },
            error: function(){
                //Handle the error
            }
        });
    }
 

Users who are viewing this thread

Top