Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //this is your shortlink.php file
- require_once $_SERVER['DOCUMENT_ROOT'] . '/path/config.php';
- /* Create a shortlink from the given URL. Only needs to be valid for about 20 minutes. */
- function shortlink_create(string $longurl) {
- global $cfg_shortlink;
- global $cfg_shortlink_key;
- global $RandomNumber;
- $result = @json_decode(file_get_contents($cfg_shortlink[$RandomNumber] . $cfg_shortlink_key[$RandomNumber] . "&url=" . urlencode($longurl)), true);
- if($result['status'] === 'error')
- die($result['message']);
- else
- return $result['shortenedUrl'];
- }
- ?>
- <?php
- // this is what should be in your config file
- // Shortlink ApiKeys
- // NOTE: api keys and links should match up in the arrays
- $cfg_shortlink_key[0] = '';
- $cfg_shortlink_key[1] = '';
- $cfg_shortlink_key[2] = '';
- $cfg_shortlink_key[3] = '';
- $cfg_shortlink_key[4] = '';
- $cfg_shortlink_key[5] = '';
- $cfg_shortlink_key[6] = '';
- $cfg_shortlink_key[7] = '';
- // Shortlink Apis
- $cfg_shortlink[0] = 'https://oturl.com/api?api=';
- $cfg_shortlink[1] = 'https://linkrex.net/api?api=';
- $cfg_shortlink[2] = 'http://oke.io/api/?api=';
- $cfg_shortlink[3] = 'https://short2win.com/api?api=';
- $cfg_shortlink[4] = 'https://oturl.com/api?api=';
- $cfg_shortlink[5] = 'https://ourl.io/api?api=';
- $cfg_shortlink[6] = 'https://link4win.com/api?api=';
- $cfg_shortlink[7] = 'https://cashat.net/api?api=';
- $RandomNumber = mt_rand(0,7);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement