CloudSide Short

Definition

Short your links with CloudSide's Short URl: http://cldsi.de

API URL

You can reach our API via a response URl. Thats the response URl:
http://cloudside.li/short/api.php or https://jokenetwork.de/cloudside/short/api.php (This is SSL-Secured)

Responses

000 = Success
100 = You didn't provide a URL to short
101 = You didn't provide a valid URL to short
102 = Ouh oh, something went wrong in our systems
116 = Something failed while transmitting the data


Choose format

Choose the repsonse Format by adding &format= to the url
txt for txt output (default)
xml for xml output
json for json output
html for html output, equivalent to txt

 

Example responses

txt and html-Output: http://cldsi.de/sample or in case of an error: 100 (101,102,116)

xml-Output:

// Success Response
<response>
  <code>000</code>
  <data>
   <url>http://cldsi.de/sample</url>
   <hash>sample</hash>
   <long_url>http://yourlongurl.com</long_url>
  </data>
</response>

// Error Response
<response>
<code>101</code>
<data/>
</response>


json-Output:

// Success Response
{ "code": 000, "data": {"long_url": "http://yourlongurl.com", "url": "http://cldsi.de/sample", "hash":"sample"} }     

// Error Response
{ "data": [ ], "code": 101  }

PHP Example

Download Script

Step 1: Call the API
<?php

$shortthis = "http://yourdomain.com";

// API URL
$cloudshort = file_get_contents('http://cloudside.li/short/api.php?url='.$shortthis);

Step 2: Handle Responses
if ($cloudshort == '100') {
    $result = 'Please enter a URL';
}
elseif ($cloudshort == '101') {
    $result = 'Please enter a valid URL';
}
elseif ($cloudshort == '102') {
    $result = 'Oops. Something went wrong on our side.';
}
elseif ($cloudshort == '116') {
    $result = 'Oops. Something went wrong on your side.';
}
else{
     $result = $cloudshort;
}

Step 3: Print shortened URl or Error-Repsonse
echo $result;

?>

Step 4: The script
<?php

$urltoshort = "http://yourdomain.com";

// API URL
$cloudshort = file_get_contents('http://cloudside.li/short/api.php?url='.$urltoshort);

if ($cloudshort == '100' || $cloudshort == 'NO_URI') {
    $result = 'Please enter a URL';
}
elseif ($cloudshort == '101' || $cloudshort == 'NON_VALID_URI') {
    $result = 'Please enter a valid URL';
}
elseif ($cloudshort == '102' || $cloudshort == 'FAIL_US') {
    $result = 'Oops. Something went wrong on our side.';
}
elseif ($cloudshort == '116' || $cloudshort == 'FAIL_YOU') {
    $result = 'Oops. Something went wrong on your side.';
}
else{
    $result = $cloudshort;
}

echo $result;

?>