Wednesday, 3 June 2015

Get short urls for Twitter with PHP

If you work with Twitter, you probably use a url shortener such as thiscode4u.blogspot.com or bit.ly to share/post your favorite blog posts or important messages with links on the network. This snippet take your url as a parameter and returns a short url.
<?php
     function getShortUrl($url){
        return file_get_contents('https://thiscode4u.blogspot.com/2014/09/php-with-oops.html?url='.$url);
    }
    ?>

0 comments:

Post a Comment