Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

tinyurl explode (See related posts)

// check where tinyurl.com is headed to

    < ?php

    // tinyurl.php?c=

    $num = $_GET['c'];

    if($fp = fsockopen ("tinyurl.com", 80, $errno, $errstr, 30))
    {
    if ($fp) {
    fputs ($fp, "HEAD /$num HTTP/1.0\r\nHost: tinyurl.com\r\n\r\n");
    while (!feof($fp)) {$headers .= fgets ($fp,128);}
    fclose ($fp);
    }
    $arr1=explode("Location:",$headers);
    $arr=explode("\n",trim($arr1[1]));
    echo trim($arr[0]);
    }
    ?>

Comments on this post

logankoester posts on Oct 31, 2007 at 01:44
Another approach (and a method to create tinyurls) http://snippets.dzone.com/posts/show/4720

You need to create an account or log in to post comments to this site.


Click here to browse all 5147 code snippets

Related Posts