Skip to content

Instantly share code, notes, and snippets.

<?php
function tiny_url($url) {
return file_get_contents('http://tinyurl.com/api-create.php?url=' . $url);
}
$json = json_decode(file_get_contents('php://input'));
echo tiny_url($json->url);
/* basic jQuery usage:
$.post('https://foo.bar/tiny-url-api.php', JSON.stringify({url: url_2b_shortened}))
@ephsmith
ephsmith / Print-All-PHP-Server-Variables.php
Created May 1, 2018 01:30
Print All PHP Server Variables
<!DOCTYPE html>
<!-- Contrbuted by GS -->
<html><head></head><body>
<?php
while (list($var,$value) = each ($_SERVER)) {
echo "$var => $value <br />";
}
?>
</body></html>
@ephsmith
ephsmith / Print-All-PHP-Environment-Variables.php
Created May 1, 2018 01:27
Print all PHP Environment Variables
<!DOCTYPE html>
<!-- Contrbuted by GS -->
<html><head></head><body>
<?php
while (list($var,$value) = each ($_ENV)) {
echo "$var => $value <br />";
}
?>
</body></html>