Short and tweet® at 101.GS

API Examples: Tiny URLs | Short Links | Quick Tweets

Turn a long and unfriendly URL (link) into a short, friendly, easy to remember link (tiny URL/Link) and tweet it!

SHORT INSTRUCTION: To use the API to remotely generate create 101.GS tiny urls or short links, you need to first generate a key. Once you have generated your key, you may call the Short and tweet® API remotely using the examples below.

EXAMPLE: SIMPLE PHP

Call format:
http://101.gs/api.php?gs_key=YOUR KEY&gs_link=base64 encoded(YOUR LINK)

<?php

$tinyurl = file_get_contents("http://101.gs/api.php?gs_key=YOUR_KEY&gs_link=".base64_encode("http://www.someverylong.url.com/index.aspx?with=lots&of=2938923923989"));

?>

EXAMPLE: SOAP (NUSOAP/PHP)

http://101.gs/soap.server.php [WSDL: http://101.gs/soap.server.php?wsdl]

<?php

define("SOAPSERVERURL","http://101.gs/soap.server.php");//Your 101.gs soap server url
define("MYKEY","XXXXXXXXXXXXX");//Your 101.gs registered api key

require_once "nusoap.php";

if ($_GET['link']) {
	$client = new nusoap_client(SOAPSERVERURL);
	$result = $client->call('createURL', array('gkey' => MYKEY,'glink' => base64_encode($_GET['link'])));
	$err = $client->getError();

	if ($err) {
		echo '<p><b>Constructor error: ' . $err . '</b></p>';
	}

	if ($client->fault) {
		echo '<p><b>Fault: ';
		print_r($result);
		echo '</b></p>';
	} else {
		$err = $client->getError();
		if ($err) {
			echo '<p><b>Error: ' . $err . '</b></p>';
			print_r($result);
		} else {
			print_r($result);
		}
	}
}

?>

EXAMPLE: ASP/PERL/RUBY/JAVA

Google it or embrace php

We call it - Short and tweet® | Support Forum