PHP: Shorten URLs using Google URL shortener API






In past 2 posts you saw how short URLs can be expanded using the Google URL shortener API. This post shows how URLs can be shortened using this API.

API key is not mandatory for test purpose. Use this link to get an API key.

For shortening URLs, 2 points must be noted. First, a HTTP POST is required and the post data should be in JSON format. Here is the code:

//This is the URL you want to shorten$longUrl ...
 •  0 comments  •  flag
Share on Twitter
Published on January 11, 2011 22:27
No comments have been added yet.