Archive

Posts Tagged ‘twitter’

LiURL.cn sightings

April 21st, 2009

As I’m keen to see more use of LiURL.cn, I do keep an eye on logs to see who’s linking to us.

Johan Sundström over at userscripts.org has written a php short url services expansion script which includes LiURL.cn.

The script is here:
http://userscripts.org/scripts/review/46822

http://longurl.org has also added support for expanding url’s. Thanks Sean!

Also, a warm thanks/谢谢 to all our users out there also in twitterland.

We also have a twitter id for those that want to follow us for the occasional tweet. – http://www.twitter.com/liurl

admin API, Sightings (LiURL.cn in the wild) , , ,

SmartShanghai.com now using LiURL

April 21st, 2009

SmartShanghai.com is now using LiURL.cn to generate small url’s for all their twitter links.

frank

Its not immediately obvious, but if you click on the Twitter link (example below), you’ll see LiURL in use.

twitter

We worked with SmartShanghai in order to assist them with integration. SmartShanghai’s original plan was to run a script to generate url’s for all 5000+ venues. While this would have worked, it wasn’t an optimal solution for either site.

Our revised design works something like this.

On page load, SmartShanghai checks to see if they have a small url for the page in their database.
If they don’t, they call LiURL’s API (http://liurl.cn/api-create.php?url=[YOURURL]) to generate a Little URL, and save the URL locally in their database.

Simple, and elegant. URL’s are generated only once, on a page request by a user.

If you would like to use LiURL.cn in your site, let us know, and we can assist with integration.

For the technically inclined, sample PHP code to use LiURL.cn is below.

<?php

//Use cUrl to retrieve content
function get_content($url) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}

//URL = url to encode
$url="http://www.example.com";

//Call the LiURL api
$content = get_content ("http://liurl.cn/api-create.php?url=". $url);

//Show our short url
echo $content;

?>
 

admin API, Site Related , , , ,