Shorten URLs using the Google URL Shortener and PHP
文章推薦指數: 80 %
short_url)){
$qr=!is_null($qr)?'.qr':'';
return$results->short_url.$qr;
}
returnFALSE;
}
returnFALSE;
}
trigger_error("cURLrequiredtoshortenURLs.",E_USER_WARNING);//Showtheuseraneaterror.
returnFALSE;
}
//Example:JusttheShortURL
echoshorten('http://www.google.com/');
//Example:GivetheShortCodeURLandimageit.
$qrURL=shorten('http://www.google.com/',TRUE);
echo'
延伸文章資訊
- 1Google URL Shortener PHP Class - David Walsh Blog
The class features two main methods: shorten and expand. Each method takes the long or short URL,...
- 2Google API - URL Shortener with PHP - Stack Overflow
$shortLink = get_object_vars($json); echo "Shortened URL is: ".$shortLink['id'];. It could be jus...
- 3Google URL Shortener PHP类 - 代码先锋网
I took a few minutes to review their API and created a very basic GoogleUrlApi class that will sh...
- 410個最佳PHP網址縮短腳本 - Tuts+ Code
有大量的PHP URL縮短腳本可以開發成壹個完全可靠的貨幣化鏈接縮短服務, ... 使用Google Shortener API,這個PHP URL縮短器腳本既漂亮 又強大。
- 5Google Short URL API for Laravel - 經驗交流分享與備忘- 痞客邦
由於需要寫自動將網址轉成google 短網址, 所以需要用到Google Short URL api, ... 回到專案根目錄, 執行php artisan vendor:publish ...