PHP code example of yuseferi / google-shortly-php
1. Go to this page and download the library: Download yuseferi/google-shortly-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yuseferi / google-shortly-php example snippets
try {
$googShort = new \yuseferi\GoogShortly('YOUR_GOOGLE_API');
echo $googShort->shorten('http://yuseferi.com');
} catch (\yuseferi\GoogShortlyException $e) {
printf('Error (%d): %s', $e->getCode(), $e->getMessage());
}
try {
$googShort = new \yuseferi\GoogShortly('YOUR_GOOGLE_API');
echo $googShort->expand('http://goo.gl/KkZ8');
} catch (\yuseferi\GoogShortlyException $e) {
printf('Error (%d): %s', $e->getCode(), $e->getMessage());
}
sh
$ composer