Skip to content

Instantly share code, notes, and snippets.

View nhalstead's full-sized avatar
👨‍💻
Something. Maybe cool

Noah Halstead nhalstead

👨‍💻
Something. Maybe cool
View GitHub Profile
@nhalstead
nhalstead / api-shorte.php
Last active June 10, 2017 01:27 — forked from dchomicz/api-test.php
Shorte.st Sample API File. Works with V1 of their API
<?php
if(!isset($authKey)) { $authKey = "YOUR KEY HERE"; }
if(!isset($longURL)) { $longURL = "http://join-shortest.com/ref/46cc802beb?user-type=new"; }
$storeShortLink = "linkout";
DEFINE("apiBaseAddress", "https://api.shorte.st/v1/data/url");
function formatURLPostData($url){ return "urlToShorten=".$url; }
function http_exist($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { return "https://" . $url; }
else { return $url; }