News Feed

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

Lorna Mitchell's Blog:
July 28, 2011 @ 12:03:02

Lorna Mitchell has a quick post to her blog today showing how you can use a simple curl call from PHP to shorten urls with and pull back the result.

I've been looking around for a really simple API that would be a nice place to get started using web services from PHP - and I realised that actually fits the bill really well. They have straightforward api docs on google code, and it's also a pretty simple function!

Her code is about three lines consisting of a curl_init call to the server with the URL, a curl_setopt to tell it to return the information and a curl_exec to execute. The result is a JSON string easily decoded with a "url" parameter containing the newly minted short URL. She also briefly mentions some of the other features of the API including reverse translation and bundling of links.

0 comments voice your opinion now!
bitly url shortening api curl example

blog comments powered by Disqus

Similar Posts

Web Development Blog: Create PDF documents Online with TCPDF

MySQL Performance Blog: Integers in PHP, running with scissors, and portability

Andrei Zmievski's Blog: Bloom Filters Quickie How to Upload Images Using PHP

Raphael Stolt's Blog: Tinyizing URLs with Zend_Http_Client

Community Events

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

series opinion language voicesoftheelephpant podcast framework api extension unittest introduction laravel5 version interview release laravel library threedevsandamaybe security symfony community

All content copyright, 2015 :: - Powered by the Solar PHP Framework