개발2013. 9. 27. 13:06
300x250


<?php
function getShortURL($longUrl) {
    $url = "http://udanax.org/shorturl.jsp?mode=api&longurl=";
    $url .= urlencode($longUrl);
    $data = file_get_contents($url);
    $json = json_decode($data, true);
    return "http://udanax.org/".$json['shorturl'];
}

echo getShortUrl("http://lyricsbird.net/lyrics.php?title=%EC%9E%A1%EC%9D%8C&id=672169");
?>


** 출처 : http://blog.udanax.org/2010/05/php-short-url-api.html


300x250
Posted by 마스타