Create TinyURL with PHP

function getTinyUrl($url) {
	return file_get_contents('http://tinyurl.com/api-create.php?url='.urlencode($url));
}
 
// Example Use:
$url = 'http://google.com';
echo getTinyUrl($url);

Download this snippet

This PHP function uses the TinyURL API to create a shorter URL.

Twitter Twitter

5 Comments to “ Create TinyURL with PHP”

  1. Anonymous  on Sep 25, 2009

    q964mv <a href="http://jzrktlwangsw.com/">jzrktlwangsw</a>, [url=http://xugsajlcwjtk.com/]xugsajlcwjtk[/url], [link=http://hnxeigqqorpf.com/]hnxeigqqorpf[/link], http://xqpokjrmiyfv.com/

  2. Anonymous  on Nov 04, 2009

    6yzMB1 <a href="http://wewepdtzizfp.com/">wewepdtzizfp</a>, [url=http://fhtsvlntaxek.com/]fhtsvlntaxek[/url], [link=http://jfsyqjsbjkwk.com/]jfsyqjsbjkwk[/link], http://uemjjofvswzw.com/

  3. Anonymous  on Jan 13, 2010

    F4eEzz <a href="http://dfbfoshjaqll.com/">dfbfoshjaqll</a>, [url=http://bniwhhfbnvwp.com/]bniwhhfbnvwp[/url], [link=http://onvkijugwpjj.com/]onvkijugwpjj[/link], http://xywvtroiwffh.com/

  4. Anonymous  on Jan 21, 2010

    Xy7rwD <a href="http://hsugdbpfbaxu.com/">hsugdbpfbaxu</a>, [url=http://jaaefiobguiz.com/]jaaefiobguiz[/url], [link=http://dorqppecvwzs.com/]dorqppecvwzs[/link], http://vgibbrfsxnpb.com/

  5. Anonymous  on Mar 14, 2010

    3NVaKx <a href="http://ctcwyqvydryo.com/">ctcwyqvydryo</a>, [url=http://luofopmhrady.com/]luofopmhrady[/url], [link=http://qwfwcrcrcmja.com/]qwfwcrcrcmja[/link], http://cntzlhtmfapl.com/

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>