CloudSide Short



Definition

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

API URL

You can reach our API via a response URL:
http://cloudside.li/short/api.php.

Not working SSL-Secured: https://jokenetwork.de/short/api.php

Responses

000 = Success
100 = You didn't provide a URL to short
101 = You didn't provide a valid URL to short (Always enter http://)
102 = Unknown error. Please try again
116 = Something failed while transmitting the data

Format

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

Deprecated
html for html output

Example responses

txt-Output:

// Success Response
http://cldsi.de/sample

// Error Response
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>
   <more>
    <title>Site-Title</title>
    <description>Meta-Description</description>
  </more>
  </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;

?>