
<?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>BlueⓘBlog &#187; bit.ly</title>
	<atom:link href="http://www.blueiblog.com/ko/archives/tag/bit-ly/feed" rel="self" type="application/rss+xml" />
	<link>http://www.blueiblog.com/ko</link>
	<description>Blueⓘ의 인터넷 아지트</description>
	<lastBuildDate>Mon, 19 Jul 2010 05:42:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>bit.ly Short URL API – jQuery로 Shorten 메소드 이용해보기</title>
		<link>http://www.blueiblog.com/ko/archives/2546</link>
		<comments>http://www.blueiblog.com/ko/archives/2546#comments</comments>
		<pubDate>Mon, 07 Jun 2010 02:55:35 +0000</pubDate>
		<dc:creator>Blueⓘ</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Open API]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[bit.ly]]></category>

		<guid isPermaLink="false">http://www.blueiblog.com/ko/archives/2546</guid>
		<description><![CDATA[PHP – bit.ly Short URL API API Key 획득 및 API 목록 Shorten 메소드 설명 PHP로 Shorten 메소드 이용해보기 jQuery로 Shorten 메소드 이용해보기 이번에는 jQuery를 이용 한 bit.ly API 코딩 실전으로 들어가겠습니다. 기본적으로 jQuery(JavaScript)를 이용한 외부 서버 접속은 보안상의 이슈로 처리 되지 않습니다만, JSON의 경우는 JavaScript로도 보안상의 문제 없이 외부 서버의 JSON을 처리 할 수 [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin: 0 0 10px 20px; background: #fff;">
<fieldset>
<legend>PHP – bit.ly Short URL API</legend>
<ol style="margin: 0; padding: 0 35px 0 20px;">
<li><a href="http://www.blueiblog.com/ko/archives/1976">API Key 획득 및 API 목록</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/1986">Shorten 메소드 설명</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2029">PHP로 Shorten 메소드 이용해보기</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2546">jQuery로 Shorten 메소드 이용해보기</a></li>
</ol>
</fieldset>
</div>
<p>이번에는 jQuery를 이용 한 bit.ly API 코딩 실전으로 들어가겠습니다. </p>
<p>기본적으로 jQuery(JavaScript)를 이용한 외부 서버 접속은 보안상의 이슈로 처리 되지 않습니다만, JSON의 경우는 JavaScript로도 보안상의 문제 없이 외부 서버의 JSON을 처리 할 수 있습니다. bit.ly의 API는 JSON을 지원하기때문에 우리는 jQuery AJAX의 JSON을 이용하여 동적으로 Shorten URL을 서비스 할 수 있습니다.</p>
<h2>jQuery로 Shorten메소드 호출</h2>
<p>앞서 3장에서 다룬 내용대로 &#8220;http://www.blueiblog.com/ko/archives/1976&#8243;을 줄일때 우리는 &#8220;http://api.bit.ly/shorten?version=2.0.1&#038;longUrl=http://www.blueiblog.com/ko/archives/1976&#038;login=xxxx&#038;apiKey=xxxxxxxxxxxx&#8221;와 같이 Shorten URL을 요청했습니다. </p>
<p>그럼 3장과 같은 내용의 함수를 jQuery로 바꾸어보도록 하겠습니다.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * License by Blueⓘ
 *
 * @param String longURL 짧게 변경할 긴 문자열의 URL
 * @return String 짧게 변환된 URL
 */</span>
<span style="color: #003366; font-weight: bold;">function</span> getShortURL<span style="color: #009900;">&#40;</span>longURL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> ret<span style="color: #339933;">;</span>
	$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span>
		<span style="color: #3366CC;">&quot;http://api.bit.ly/shorten?version=2.0.1&amp;longUrl=&quot;</span><span style="color: #339933;">+</span>longURL<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&amp;login=xxxx&amp;apiKey=xxxxxxxxxxxx&quot;</span><span style="color: #339933;">,</span>
		<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			ret <span style="color: #339933;">=</span> data.<span style="color: #660066;">results</span><span style="color: #009900;">&#91;</span>url<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">shortUrl</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> ret<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
$<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>getShortURL<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://test.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// OUTPUT : http://bit.ly/9ICmwA</span></pre></div></div>

<p>이렇게 바뀔 수 있겠네요.. 위 코드는 테스트 없이 그냥 즉석에서 소스를 jQuery용으로 변경 한 것입니다. 테스트 없이 코드를 올려서 죄송합니다 ㅠ.ㅠ 혹 문제가 없을거라고 믿으나 있다면 댓글로 노티 부탁드리겠습니다.</p>
<div style="margin: 10px 0 10px 0; border: 3px solid #6FA7D1; display: inline-block; width: 720px;">
<p style="padding: 0 0 0 20px; margin: 0; line-height: 30px; border-bottom: 1px solid #6FA7D1; background: #CBDEED; font-weight: bold;">이 글이 도움이 않되셨더라도 왼쪽 아래에 있는 손 모양의 추천을 눌러주세요...^^</p>
<ul style="list-style-type: none; margin: 0;; padding: 0;">
<li style="width: 100px; float: left; padding-left: 30px; padding-top: 5px; margin: 5px 0;">
<embed src="http://api.v.daum.net/static/recombox3.swf?nid=7389289" quality="high" bgcolor="#ffffff" width="67" height="80" type="application/x-shockwave-flash"></embed>
</li><li style="height: 100px; overflow: hidden; padding: 20px 0 0 0; text-align: center; margin-bottom: -20px;">
<script type='text/javascript'><!--
google_ad_client = 'pub-1866412074966530';
/* 468x60, 작성됨 09. 10. 29 */
google_ad_slot = '9943142053';
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>
</li>
</ul></textarea>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.blueiblog.com/ko/archives/2546/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>bit.ly Short URL API – PHP로 Shorten 메소드 이용해보기</title>
		<link>http://www.blueiblog.com/ko/archives/2029</link>
		<comments>http://www.blueiblog.com/ko/archives/2029#comments</comments>
		<pubDate>Sun, 07 Feb 2010 07:37:35 +0000</pubDate>
		<dc:creator>Blueⓘ</dc:creator>
				<category><![CDATA[Open API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[bit.ly]]></category>

		<guid isPermaLink="false">http://www.blueiblog.com/ko/archives/2029</guid>
		<description><![CDATA[PHP – bit.ly Short URL API API Key 획득 및 API 목록 Shorten 메소드 설명 PHP로 Shorten 메소드 이용해보기 jQuery로 Shorten 메소드 이용해보기 그럼 앞의 두 강좌를 기본으로 PHP를 이용한 bit.ly API 코딩하기 실전으로 들어가도록 하겠습니다. 이 API 코딩법만 익히게 되면 다른 bit.ly API를 이용하는것도 어렵지 않으니 집중하고 내용을 이해 하도록 노력해 주세요. P.S. 그리고 [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin: 0 0 10px 20px; background: #fff;">
<fieldset>
<legend>PHP – bit.ly Short URL API</legend>
<ol style="margin: 0; padding: 0 35px 0 20px;">
<li><a href="http://www.blueiblog.com/ko/archives/1976">API Key 획득 및 API 목록</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/1986">Shorten 메소드 설명</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2029">PHP로 Shorten 메소드 이용해보기</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2546">jQuery로 Shorten 메소드 이용해보기</a></li>
</ol>
</fieldset>
</div>
<p>그럼 앞의 두 강좌를 기본으로 PHP를 이용한 bit.ly API 코딩하기 실전으로 들어가도록 하겠습니다. 이 API 코딩법만 익히게 되면 다른 bit.ly API를 이용하는것도 어렵지 않으니 집중하고 내용을 이해 하도록 노력해 주세요.</p>
<p><strong>P.S. 그리고 댓글좀 써주세요 ㅡㅡ; 댓글 없는 포스팅을 보게되면 강좌를 연재할 의욕이 꺽인답니다. ^^</strong></p>
<h2>PHP로 Shorten메소드 호출</h2>
<p>이제 어떠한 방식으로 데이터를 주고받는지 알게 되었다면 PHP를 이용하여 bit.ly의 API를 이용하여 짧은 URL을 얻어오는 방법을 설명 하겠습니다. 이번 강의에서 사용될 PHP의 함수는 아래와 같습니다.</p>
<ol>
<li><strong><a href="http://kr.php.net/manual/kr/function.file-get-contents.php" target="_blank">file_get_contents</a></strong> : 로컬내 파일 또는 원격지의 파일 내용을 문자열로 가져오는 함수</li>
<li><strong><a href="http://kr.php.net/manual/kr/function.json-decode.php" target="_blank">json_decode</a></strong> : JSON으로 만들어진 문자열을 JSON 객체로 변환 해주는 함수</li>
</ol>
<p>위 두 함수는 모두 PHP 코어의 일부분으로 따로 설치 하실 필요는 없습니다. 다만 PHP 버젼에 따라 작동되지 않을 수 있습니다.</p>
<p>그럼 간단하게 긴URL을 bit.ly에 던져서 짧은URL을 얻어 출력하는 내용으로 코딩 해보도록 하겠습니다.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://api.bit.ly/shorten?version=2.0.1&amp;longUrl=http://www.blueiblog.com/ko/archives/1976&amp;login=xxxx&amp;apiKey=xxxxxxxxxxxx&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">json_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$surl</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">shortCNAMEUrl</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$surl</span><span style="color: #339933;">;</span></pre></div></div>

<p>그럼 이번에는 함수를 만들어서 언제든 빼 쓸 수 있도록 해보겠습니다.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * License by Blueⓘ
 *
 * @param String longURL 짧게 변경할 긴 문자열의 URL
 * @return String 짧게 변환된 URL
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> getShortURL<span style="color: #009900;">&#40;</span><span style="color: #000088;">$longURL</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://api.bit.ly/shorten?version=2.0.1&amp;longUrl=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$longURL</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&amp;login=xxxx&amp;apiKey=xxxxxxxxxxxx&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">json_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$surl</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">shortCNAMEUrl</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$surl</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> getShortURL<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://test.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// OUTPUT : http://bit.ly/9ICmwA</span></pre></div></div>

<div style="margin: 10px 0 10px 0; border: 3px solid #6FA7D1; display: inline-block; width: 720px;">
<p style="padding: 0 0 0 20px; margin: 0; line-height: 30px; border-bottom: 1px solid #6FA7D1; background: #CBDEED; font-weight: bold;">이 글이 도움이 않되셨더라도 왼쪽 아래에 있는 손 모양의 추천을 눌러주세요...^^</p>
<ul style="list-style-type: none; margin: 0;; padding: 0;">
<li style="width: 100px; float: left; padding-left: 30px; padding-top: 5px; margin: 5px 0;">
<embed src="http://api.v.daum.net/static/recombox3.swf?nid=5742339" quality="high" bgcolor="#ffffff" width="67" height="80" type="application/x-shockwave-flash"></embed>
</li><li style="height: 100px; overflow: hidden; padding: 20px 0 0 0; text-align: center; margin-bottom: -20px;">
<script type='text/javascript'><!--
google_ad_client = 'pub-1866412074966530';
/* 468x60, 작성됨 09. 10. 29 */
google_ad_slot = '9943142053';
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>
</li>
</ul></textarea>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.blueiblog.com/ko/archives/2029/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>bit.ly Short URL API – Shorten 메소드 설명</title>
		<link>http://www.blueiblog.com/ko/archives/1986</link>
		<comments>http://www.blueiblog.com/ko/archives/1986#comments</comments>
		<pubDate>Sat, 06 Feb 2010 02:41:49 +0000</pubDate>
		<dc:creator>Blueⓘ</dc:creator>
				<category><![CDATA[Open API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[bit.ly]]></category>

		<guid isPermaLink="false">http://www.blueiblog.com/ko/archives/1986</guid>
		<description><![CDATA[PHP – bit.ly Short URL API API Key 획득 및 API 목록 Shorten 메소드 설명 PHP로 Shorten 메소드 이용해보기 jQuery로 Shorten 메소드 이용해보기 이번에는 앞서 설명했던 내용을 토대로 shorten메소드에 대해서 알아보도록 하겠습니다. shorten메소드는 bit.ly의 API중 우리가 가장 많이 사용하게 될 메소드입니다. shorten메소드는 http://www.blueiblog.com/ko/archives/1976 와 같은 긴 주소를 http://bit.ly/b4ihSW 와 같이 짧게 줄여주는 역활을 합니다. 그럼 [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin: 0 0 10px 20px; background: #fff;">
<fieldset>
<legend>PHP – bit.ly Short URL API</legend>
<ol style="margin: 0; padding: 0 35px 0 20px;">
<li><a href="http://www.blueiblog.com/ko/archives/1976">API Key 획득 및 API 목록</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/1986">Shorten 메소드 설명</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2029">PHP로 Shorten 메소드 이용해보기</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2546">jQuery로 Shorten 메소드 이용해보기</a></li>
</ol>
</fieldset>
</div>
<p>이번에는 앞서 설명했던 내용을 토대로 shorten메소드에 대해서 알아보도록 하겠습니다. shorten메소드는 bit.ly의 API중 우리가 가장 많이 사용하게 될 메소드입니다. shorten메소드는 http://www.blueiblog.com/ko/archives/1976 와 같은 긴 주소를 http://bit.ly/b4ihSW 와 같이 짧게 줄여주는 역활을 합니다.</p>
<p>그럼 shorten메소드의 사용법에 대해서 알아보도록 하겠습니다.</p>
<h2>Shorten Method 요청 및 결과</h2>
<p>Shorten메소드는 아래와 같은 파라미터를 입력해야 사용 할 수 있습니다. 입력해야 할 파라미터와 그 설명은 아래와 같습니다.</p>
<fieldset>
<legend>Parameter</legend>
<ul style="margin-top: 0; margin-bottom: 0;">
<li><strong>version</strong> : API 버젼을 입력하는 기본 파라미터(모든 함수 동일)</li>
<li><strong>login</strong> : API를 이용할 아이디(모든 함수 동일)</li>
<li><strong>apiKey</strong> : API를 이용할 Key(모든 함수 동일)</li>
<li><strong>format</strong> : xml과 json중 선택 가능, format파라미터를 입력하지 않으면 JSON으로 반환</li>
<li><strong style="color:blue;">longUrl</strong> : 짧은 URL로 변경할 원래 URL</li>
</ul>
</fieldset>
<p>그럼 위 메소드를 어떻게 사용하는지 알아보도록 하겠습니다. 우선 http://www.blueiblog.com/ko/archives/1976 주소를 짧게 변경하고 싶다면 아래와 같이 shorten메소드를 호출 해 보겠습니다. 브라우저의 주소 입력 창에 아래와 같이 입력해보세요. <span style="text-decoration: underline;">(아래 이미지를 클릭하시면 원본 사이즈로 보실 수 있습니다.)</span></p>
<p><a href="http://www.blueiblog.com/ko/wp-content/uploads/2010/02/2010-02-06_112346.gif"><img src="http://www.blueiblog.com/ko/wp-content/uploads/2010/02/2010-02-06_112346-720x35.gif" alt="" title="2010-02-06_112346" width="720" height="35" class="aligncenter size-large wp-image-1994" /></a></p>

<div class="wp_syntax"><div class="code"><pre class="url" style="font-family:monospace;">http://api.bit.ly/shorten?version=2.0.1&amp;longUrl=http://www.blueiblog.com/ko/archives/1976&amp;login=xxxx&amp;apiKey=xxxxxxxxxxxx</pre></div></div>

<p>이와 같이 브라우져에 데이터를 요청하게 되면 다음과 같은 결과를 얻을 수 있습니다.</p>

<div class="wp_syntax"><div class="code"><pre class="json" style="font-family:monospace;">{
    &quot;errorCode&quot;: 0, 
    &quot;errorMessage&quot;: &quot;&quot;, 
    &quot;results&quot;: {
        &quot;http://www.blueiblog.com/ko/archives/1976&quot;: {
            &quot;hash&quot;: &quot;b4ihSW&quot;, 
            &quot;shortCNAMEUrl&quot;: &quot;http://bit.ly/9pTARb&quot;, 
            &quot;shortKeywordUrl&quot;: &quot;&quot;, 
            &quot;shortUrl&quot;: &quot;http://bit.ly/9pTARb&quot;, 
            &quot;userHash&quot;: &quot;9pTARb&quot;
        }
    }, 
    &quot;statusCode&quot;: &quot;OK&quot;
}</pre></div></div>

<p>위 결과 처럼 Shorten메소드의 호출 결과는 JSON데이터로 반환 됩니다. format파라미터를 xml로 입력하면 xml로 결과를 반환 받을 수 있습니다. 아래는 xml로 반환 받은 경우의 결과 데이터 입니다.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bitly<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;errorCode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/errorCode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;errorMessage</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;results<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nodeKeyVal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;shortKeywordUrl</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;hash<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>b4ihSW<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/hash<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;userHash<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>9pTARb<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/userHash<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nodeKey<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.blueiblog.com/ko/archives/1976<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/nodeKey<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;shortUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://bit.ly/9pTARb<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/shortUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;shortCNAMEUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://bit.ly/9pTARb<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/shortCNAMEUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/nodeKeyVal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/results<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;statusCode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>OK<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/statusCode<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bitly<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>위 결과 처럼 xml로도 데이터를 반환 받을 수 있습니다. 하지만 우리는 기본포맷인 json으로 받은 데이터를 이용하여 프로그램을 작성 할 것입니다.</p>
<div style="margin: 10px 0 10px 0; border: 3px solid #6FA7D1; display: inline-block; width: 720px;">
<p style="padding: 0 0 0 20px; margin: 0; line-height: 30px; border-bottom: 1px solid #6FA7D1; background: #CBDEED; font-weight: bold;">이 글이 도움이 않되셨더라도 왼쪽 아래에 있는 손 모양의 추천을 눌러주세요...^^</p>
<ul style="list-style-type: none; margin: 0;; padding: 0;">
<li style="width: 100px; float: left; padding-left: 30px; padding-top: 5px; margin: 5px 0;">
<embed src="http://api.v.daum.net/static/recombox3.swf?nid=5731093" quality="high" bgcolor="#ffffff" width="67" height="80" type="application/x-shockwave-flash"></embed>
</li><li style="height: 100px; overflow: hidden; padding: 20px 0 0 0; text-align: center; margin-bottom: -20px;">
<script type='text/javascript'><!--
google_ad_client = 'pub-1866412074966530';
/* 468x60, 작성됨 09. 10. 29 */
google_ad_slot = '9943142053';
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>
</li>
</ul></textarea>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.blueiblog.com/ko/archives/1986/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>bit.ly Short URL API &#8211; API Key 획득 및 API 목록</title>
		<link>http://www.blueiblog.com/ko/archives/1976</link>
		<comments>http://www.blueiblog.com/ko/archives/1976#comments</comments>
		<pubDate>Fri, 05 Feb 2010 07:56:41 +0000</pubDate>
		<dc:creator>Blueⓘ</dc:creator>
				<category><![CDATA[Open API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[bit.ly]]></category>

		<guid isPermaLink="false">http://www.blueiblog.com/ko/archives/1976</guid>
		<description><![CDATA[PHP – bit.ly Short URL API API Key 획득 및 API 목록 Shorten 메소드 설명 PHP로 Shorten 메소드 이용해보기 jQuery로 Shorten 메소드 이용해보기 마이크로 블로깅으로 인해 숏URL 서비스가 인기를 얻는 세상이 왔습니다. 옛날 같으면 쓰지도 않던 기능인데 말이죠 ^^ 저 역시 블로그 글을 출판하게 되면 자동으로 트위터에 포스트의 제목과 URL을 추가하여 출판하고 있습니다. 하지만 역시 [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin: 0 0 10px 20px; background: #fff;">
<fieldset>
<legend>PHP – bit.ly Short URL API</legend>
<ol style="margin: 0; padding: 0 35px 0 20px;">
<li><a href="http://www.blueiblog.com/ko/archives/1976">API Key 획득 및 API 목록</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/1986">Shorten 메소드 설명</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2029">PHP로 Shorten 메소드 이용해보기</a></li>
<li><a href="http://www.blueiblog.com/ko/archives/2546">jQuery로 Shorten 메소드 이용해보기</a></li>
</ol>
</fieldset>
</div>
<p>마이크로 블로깅으로 인해 숏URL 서비스가 인기를 얻는 세상이 왔습니다. 옛날 같으면 쓰지도 않던 기능인데 말이죠 ^^</p>
<p>저 역시 블로그 글을 출판하게 되면 자동으로 트위터에 포스트의 제목과 URL을 추가하여 출판하고 있습니다. 하지만 역시 블로그의 주소는 길기에&#8230; 어쩔수 없이 Short URL기능을 이용해야 합니다. 그래서 <a href="http://bit.ly" target="_blank">bit.ly</a>의 Short URL API에 대해 알아 보았습니다.</p>
<p>그럼 PHP를 이용하여 <a href="http://bit.ly" target="_blank">bit.ly</a>의 Short URL을 가져오는 방법에 대해서 알아보도록 하겠습니다.</p>
<h2>bit.ly의 API Key 얻기</h2>
<p>여느 API와 마찬가지로 API를 이용하기 위해서는 API Key를 얻어야 합니다. 우선 <a href="http://bit.ly" target="_blank">http://bit.ly</a>의 홈페이지로 이동 한 후 회원가입을 합니다. 회원 가입후 어카운트 정보를 확인하면 아래와 같이 API Key가 보여집니다. (제 API Key 보안을 위해 ^^; 해당 부분은 모자이크 처리 했습니다.)</p>
<p><a href="http://www.blueiblog.com/ko/wp-content/uploads/2010/02/2010-02-05_164433.gif"><img src="http://www.blueiblog.com/ko/wp-content/uploads/2010/02/2010-02-05_164433-720x340.gif" alt="" title="2010-02-05_164433" width="720" height="340" class="aligncenter size-large wp-image-1978" /></a></p>
<p>물론 이렇게 얻은 API Key가 유출되었다면 우측의 Reset키를 누르시면 새로운 API Key를 발급 받으실수 있습니다.</p>
<h2>bit.ly API 목록</h2>
<p><a href="http://bit.ly" target="_blank">bit.ly</a>는 다른 OPEN API에 비해 API의 종류가 매우 간단합니다. 우선 API 리스트는 아래와 같습니다.</p>
<ol>
<li><strong>shorten</strong> : 우리가 제일 필요로 하는 API로 URL을 bit.ly의 짧은 URL로 바꾸어주는 API입니다.</li>
<li><strong>expand</strong> : bit.ly/xxxxx 형식으로 되어 있는 Short URL을 원래의 URL로 바꾸어주는 API입니다.</li>
<li><strong>info</strong> : bit.ly의 Short URL에 해당하는 정보를 보여주는 API입니다.</li>
<li><strong>stats</strong> : bit.ly Short URL의 트래픽 및 레퍼러 정보를 보여주는 API입니다.</li>
<li><strong>errors</strong> : bit.ly에서 사용되는 ERROR CODE를 보여주는 API입니다.</li>
</ol>
<p>P.S. bit.ly의 API 문서 페이지는 <a href="http://code.google.com/p/bitly-api/wiki/ApiDocumentation" target="_blank">http://code.google.com/p/bitly-api/wiki/ApiDocumentation</a> 입니다.</p>
<div style="margin: 10px 0 10px 0; border: 3px solid #6FA7D1; display: inline-block; width: 720px;">
<p style="padding: 0 0 0 20px; margin: 0; line-height: 30px; border-bottom: 1px solid #6FA7D1; background: #CBDEED; font-weight: bold;">이 글이 도움이 않되셨더라도 왼쪽 아래에 있는 손 모양의 추천을 눌러주세요...^^</p>
<ul style="list-style-type: none; margin: 0;; padding: 0;">
<li style="width: 100px; float: left; padding-left: 30px; padding-top: 5px; margin: 5px 0;">
<embed src="http://api.v.daum.net/static/recombox3.swf?nid=5723626" quality="high" bgcolor="#ffffff" width="67" height="80" type="application/x-shockwave-flash"></embed>
</li><li style="height: 100px; overflow: hidden; padding: 20px 0 0 0; text-align: center; margin-bottom: -20px;">
<script type='text/javascript'><!--
google_ad_client = 'pub-1866412074966530';
/* 468x60, 작성됨 09. 10. 29 */
google_ad_slot = '9943142053';
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type='text/javascript'
src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>
</script>
</li>
</ul></textarea>
</div>]]></content:encoded>
			<wfw:commentRss>http://www.blueiblog.com/ko/archives/1976/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
