<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Li(ttle)URL.cn &#187; franck</title>
	<atom:link href="http://blog.liurl.cn/tag/franck/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.liurl.cn</link>
	<description>Behind the scene's at LiURL.cn</description>
	<lastBuildDate>Sat, 25 Apr 2009 04:07:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SmartShanghai.com now using LiURL</title>
		<link>http://blog.liurl.cn/2009/04/smartshanghaicom-now-using-liurl/</link>
		<comments>http://blog.liurl.cn/2009/04/smartshanghaicom-now-using-liurl/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 23:38:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Site Related]]></category>
		<category><![CDATA[franck]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[smartshanghai]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.liurl.cn/?p=36</guid>
		<description><![CDATA[SmartShanghai.com is now using LiURL.cn to generate small url&#8217;s for all their twitter links.

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

We worked with SmartShanghai in order to assist them with integration.  SmartShanghai&#8217;s original plan was to run a script to generate url&#8217;s for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.SmartShanghai.com">SmartShanghai.com</a> is now using LiURL.cn to generate small url&#8217;s for all their twitter links.</p>
<p><img class="aligncenter size-full wp-image-38" title="Franck Bistro Shanghai - good but expensive French food, in the French Concession" src="http://blog.liurl.cn/wp-content/uploads/2009/04/frank.jpg" alt="frank" width="585" height="431" /></p>
<p>Its not immediately obvious, but if you click on the Twitter link (example below), you&#8217;ll see LiURL in use.</p>
<p><a href="http://twitter.com/home?status=Franck%27s%20Bistro%20http://liurl.cn/ij"><img class="alignnone size-full wp-image-37" title="twitter" src="http://blog.liurl.cn/wp-content/uploads/2009/04/dating_twitter.png" alt="twitter" width="21" height="20" /></a></p>
<p>We worked with SmartShanghai in order to assist them with integration.  SmartShanghai&#8217;s original plan was to run a script to generate url&#8217;s for all 5000+ venues.  While this would have worked, it wasn&#8217;t an optimal solution for either site.</p>
<p>Our revised design works something like this.</p>
<p>On page load, SmartShanghai checks to see if they have a small url for the page in their database.<br />
If they don&#8217;t, they call LiURL&#8217;s API (http://liurl.cn/api-create.php?url=[YOURURL]) to generate a Little URL, and save the URL locally in their database.</p>
<p>Simple, and elegant.  URL&#8217;s are generated only once, on a page request by a user.</p>
<p>If you would like to use LiURL.cn in your site, let us know, and we can assist with integration.</p>
<p>For the technically inclined, sample PHP code to use LiURL.cn is below.</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="kw2">&lt;?php</span></p>
<p><span class="co1">//Use cUrl to retrieve content</span><br />
<span class="kw2">function</span> get_content<span class="br0">&#40;</span><span class="re0">$url</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="re0">$ch</span> = curl_init<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
curl_setopt <span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_URL, <span class="re0">$url</span><span class="br0">&#41;</span>;<br />
curl_setopt <span class="br0">&#40;</span><span class="re0">$ch</span>, CURLOPT_HEADER, <span class="nu0">0</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/ob_start"><span class="kw3">ob_start</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
curl_exec <span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;<br />
curl_close <span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span>;<br />
<span class="re0">$string</span> = <a href="http://www.php.net/ob_get_contents"><span class="kw3">ob_get_contents</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<a href="http://www.php.net/ob_end_clean"><span class="kw3">ob_end_clean</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">return</span> <span class="re0">$string</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="co1">//URL = url to encode</span><br />
<span class="re0">$url</span>=<span class="st0">&quot;http://www.example.com&quot;</span>;</p>
<p><span class="co1">//Call the LiURL api</span><br />
<span class="re0">$content</span> = get_content <span class="br0">&#40;</span><span class="st0">&quot;http://liurl.cn/api-create.php?url=&quot;</span>. <span class="re0">$url</span><span class="br0">&#41;</span>;</p>
<p><span class="co1">//Show our short url</span><br />
<a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="re0">$content</span>;</p>
<p><span class="kw2">?&gt;</span><br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.liurl.cn/2009/04/smartshanghaicom-now-using-liurl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
