Reveal The Url Behind A Tinyurl
Using sockets in PHP to reveal the path that a tinyurl.com URL really points to by reading the HEAD data.
|
On Sunday, July 6th 2008 at 11:33 PM By Andrei Pociu (View Profile)
    (Rated 0 with 0 votes) |
Contextual Ads
More PHP Resources
Advertisement
<?php
$TinyUrl = "http://tinyurl.com/58zbz6";
$ParamStart = stristr($TinyUrl, "tinyurl.com/");
if($FSock = fsockopen("tinyurl.com", 80, $ErrCode, $ErrMsg, 30))
{
if ($FSock)
{
fputs ($FSock, "HEAD /$C HTTP/1.0\r\nHost: tinyurl.com\r\n\r\n");
while (! feof($FSock)) {$Headers .= fgets($FSock, 128); }
}
$ArrTmp = explode("Location:", $Headers);
}
?>
|
Digg It!
Del.icio.us
Reddit
StumbleIt
Newsvine
Furl
BlinkList
|
|
Rate this code snippet
Current Comments
There are no comments.
|
Related Source Code
There is no related code.
Related Tutorials
There are no related tutorials.
PHP Job Search
|