How to integrate http://j.mp into WordPress blog?

In my WordPress Blog I’m currently using an integrated http://U.nu url-shortener.

For this I’ve got in functions.php

Read More
function getunuUrl($url) {
    $unuurl = file_get_contents("http://u.nu/unu-api-simple?url=".$url);
    return $unuurl;
}

and in my post.php

<?php $uurl = getunuUrl(get_permalink($post->ID)); 
echo '<a href="'.$uurl.'">Short Url</a>' ?>

I can’t find a way to integrate j.mp the same way. Anyone able to help me out?

Related posts

Leave a Reply

1 comment

  1. Looks like j.mp is a mirror of bit.ly
    According to bitly API:

    http://api.bit.ly/shorten?version=2.0.1&longUrl=http://cnn.com&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07
    

    I shoul change function getunuUrl (or add a new one):

    function getunuUrl($url) {
        $unuurl = file_get_contents("http://api.bit.ly/shorten?version=2.0.1&longUrl=".$url."&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07");
        return $unuurl;
    }

    Don’t forget to change login & apiKey to your own.