Sinisterly
[RELEASE] URL Shortener API Script - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: [RELEASE] URL Shortener API Script (/Thread-RELEASE-URL-Shortener-API-Script)



[RELEASE] URL Shortener API Script - Xanii - 07-22-2013

Today I'm releasing an API script to shorten URLS. You can make keys and distribute them to whomever.

Code:
<?php $keys = array("key1", "key2", "key3"); error_reporting(0); if ( !isset($_GET['url'], $_GET['key'])){ echo "Please provide all required variables!"; exit(); } // Check to see if provided key is not valid if ( !in_array($_GET['key'], $keys) ) { echo "Please provided a valid API key!"; exit(); } // Shorten URL $ur = @file_get_contents("http://my-x-api.tk/us/short.php?url=" . $_GET['url']); echo $ur; ?>

Just edit the "keys" array with the keys you would like other people to use, then call the API like:

Code:
http://yoursite.tld/phpfile.php?url=http://urlhere.com&key=APIKEY



RE: [RELEASE] URL Shortener API Script - Love - 07-22-2013

Nice share for the community.


RE: [RELEASE] URL Shortener API Script - Blue - 07-22-2013

Wow nice release for the community!


RE: [RELEASE] URL Shortener API Script - Xiledcore - 07-22-2013

Thank you, this is a nice share!

I've been thinking of learning PHP actually.


RE: [RELEASE] URL Shortener API Script - Platinum - 07-23-2013

Great work man!

(07-22-2013, 10:18 PM)Xiledcore Wrote: Thank you, this is a nice share!

I've been thinking of learning PHP actually.

PHP is actually not hard and has a ton of features, learn it I'd say!


RE: [RELEASE] URL Shortener API Script - Anizeb - 07-23-2013

Agreed. I started learning PHP when I was about 13, and whipped up an entire forum platform within a year.
It's so widespread that you'll find no shortage of information. Not to mention it's the most highly sought after language for hiring companies...


RE: [RELEASE] URL Shortener API Script - ibJustin - 07-30-2013

Very nice release! Keep up the good work!


RE: [RELEASE] URL Shortener API Script - -Correct - 07-30-2013

Very nice, thanks for sharing this!