Over a million developers have joined DZone.

Resolving A TinyURL To Destination URL

DZone's Guide to

Resolving A TinyURL To Destination URL

Free Resource
Resolving a tinyURL to its original destination URL in a fastest way.

    < ?php

    // request like this http://

    $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);
    echo trim($arr[0]);



Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}