Jump Short URL API | snails.email | Chronolabs Cooperative (Sydney, Australia)

This is an API Service for creating short URLs from this API!

Code API Documentation

You can find the phpDocumentor code API documentation at the following path :: http://snails.email/docs/. These should outline the source code core functions and classes for the API to function!

Shorten URL Document Output

This is done with the url.api extension at the end of the url.



Emails to be included in the alias, you can add/remove addresses later, email address has to be comma seperated in the following format: email@alias.snail.email, "Dr. Who Nobody" <email@alias.snail.email>
 

 
Example of Form:-
	<form action="http://snails.email/url.api" method="post" style="height: 366px !important;">
			<div style="min-width: 100%; clear: both;">
    			<label for="response-raw">Response formated RAW </label><input type="radio" name="response" id="response-raw" value="raw" />
    			<label for="response-php">Response formated PHP </label><input type="radio" name="response" id="response-php" value="php" />
    			<label for="response-json">Response formated JSON </label><input type="radio" name="response" id="response-json" value="json" checked="checked"/>
    			<label for="response-serial">Response formated PHP Serialisation</label><input type="radio" name="response" id="response-serial" value="serial"/>
    			<label for="response-xml">Response formated XML</label><input type="radio" name="response" id="response-xml" value="xml"/><br/>
    		</div>
    		<div style="min-width: 100%; clear: both;">
    			<div style="float: left; width: auto;">
        			<label for="url"> URL/URI to shorten  </label><input type="textbox" name="url" id="url" value="http://" size="36" maxlen="5000"/>
        			<label for="custom"> Custom Short Reference Preference  </label><input type="textbox" name="custom" id="custom" value="" size="12"/><br/>
        		</div>
        		<div style="float: left; width: auto;">
        			<label for="username">Username on 'http://snails.email'  </label><input type="textbox" name="username" id="username" value="" size="24" maxlen="64"/>
        			<label for="email">Your/Telephanist Contact Email  </label><input type="textbox" name="email" id="email" value="" size="24" maxlen="200"/>
        		</div>
			</div>
			<div style="min-width: 100%; clear: both; margin-top: 13px;">
				<div style="float: left; width: auto; margin-right: 11px;">
    				<div style="float: left; width: auto; clear: none; margin-right: 7px; padding-top: 22px;">
    					<div style="width: auto; clear: both; padding: 4px;"><label for="callback-hits">Call Back URL for Hits  </label><input style="width: auto; clear: none; padding: 2px;" type="textbox" name="callback-hits" id="callback-hits" value="" maxlen="200" /></div>
    					<div style="width: auto; clear: both; padding: 4px;"><label for="callback-stats">Call Back URL for Statistics  </label><input style="width: auto; clear: none; padding: 2px;" type="textbox" name="callback-stats" id="callback-stats" value="" maxlen="200" /></div>
    					<div style="width: auto; clear: both; padding: 4px;"><label for="callback-reports">Call Back URL for Reports  </label><input style="width: auto; clear: none; padding: 2px;" type="textbox" name="callback-reports" id="callback-reports" value="" maxlen="200" /></div>
    					<div style="width: auto; clear: both; padding: 4px;"><label for="callback-expires">Call Back URL for Expiry  </label><input style="width: auto; clear: none; padding: 2px;" type="textbox" name="callback-expires" id="callback-expires" value="" maxlen="200" /></div>
    				</div>
    				<div style="float: left; width: auto;">
    					<div style='width: auto; padding: 2px;  margin-right: 29px; margin-top: 19px;'>
        					<div style='word-wrap: break-word !important; font-size: 0.75em !important; margin-right: 11px; clear: both; width: 190px;'>Emails to be included in the alias, you can add/remove addresses later, email address has to be comma seperated in the following format: email@alias.snail.email, "Dr. Who Nobody" <email@alias.snail.email></div>
        					<div style='float: left; clear: both; width: auto;'><label for="emails">Email Alias Contacts:<br /><br /></label></div>
        				</div>
    				</div>
    			</div>
				<div style='float: left; width: auto; margin-left: 9px; margin-top: 19px;'>
					<textarea name="emails" id="emails" style="height: 100% !important; width: 100% !important;" rows='10' cols='49'></textarea>
				</div>
			</div>
			<div style='width: auto; float: right;'><input type="submit" id="submit" Value="Shorten URI/URL" /></div>
		</form>
		


PHP function required for cURL the form:-
<?php
	if (!function_exists("getURIData")) {
	
		/* function getURIData() cURL Routine
		 * 
		 * @author 		Simon Roberts (labs.coop) wishcraft@users.sourceforge.net
		 * @return 		string
		 */
		function getURIData($uri = '', $timeout = 25, $connectout = 25, $post_data = array())
		{
			if (!function_exists("curl_init"))
			{
				return file_get_contents($uri);
			}
			if (!$btt = curl_init($uri)) {
				return false;
			}
			curl_setopt($btt, CURLOPT_HEADER, 0);
			curl_setopt($btt, CURLOPT_POST, (count($posts)==0?false:true));
			if (count($posts)!=0)
				curl_setopt($btt, CURLOPT_POSTFIELDS, http_build_query($post_data));
			curl_setopt($btt, CURLOPT_CONNECTTIMEOUT, $connectout);
			curl_setopt($btt, CURLOPT_TIMEOUT, $timeout);
			curl_setopt($btt, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($btt, CURLOPT_VERBOSE, false);
			curl_setopt($btt, CURLOPT_SSL_VERIFYHOST, false);
			curl_setopt($btt, CURLOPT_SSL_VERIFYPEER, false);
			$data = curl_exec($btt);
			curl_close($btt);
			return $data;
		}
	}
?>
		


PHP function in use as per required for cURL:-
<?php
	// output the passed array from submission form
	print_r(json_decode(getURIData("http://snails.email/url.api", 560, 560, 
				 
				 				/* URL Upload return after submission (required) */
								array('response' => 'json', 
				
								/* URL for API Shortening  (required) */
								'url' => 'http://snails.email/ie/example/uri.html')), true));
?>