News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

phpRiot.com:
Shortening URLs for goo.gl with Google's URL Shortener API
January 12, 2011 @ 10:06:41

On phpRiot.com there's a new tutorial showing you how to use the Google URL shortener API in your PHP applications (via a curl call).

In 2010 Google released its own URL shortener, which allows you to shorten URLs to use the goo.gl domain. In this article I will show you how to easily create your own short URLs using their new URL shortener API. Note: This API is still in labs, meaning the API is subject to change without notice.

The tutorial steps you through the process of getting an API key for your scripts to use for access and what the message needs to be for the POST request to the Google service. His example script defines the API key and endpoint as well as a basic "shortenUrl" method that takes in the long URL to shorten. The curl request posts the data as JSON and receives a json-encoded message back with the original URL and the ID you wanted it shortened to.

0 comments voice your opinion now!
google shortener api tutorial curl


blog comments powered by Disqus

Similar Posts

Andreas Gohr's Blog: A Pirate Map with LibGD and Google Maps

Karsten Dambekalns' Blog: PHP, Xdebug and PhpStorm - working!

Zend Developer Zone: Data Migration and Import Examples

Kevin Waterson's Blog: Introduction to PHP Regex

Stefan Mischook's Blog: Turning on display_errors in WAMP - Video Tutorial


Community Events





Don't see your event here?
Let us know!


wordpress podcast list series introduction install configure language developer homestead threedevsandamaybe library community interview release unittest api code laravel application

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework