| |
| Senior Geek | Posts: 559 Join Date: Nov 2007 Location: Romania | |
| Fetching real URL from a script -
11-30-2007
This function will allow you to get the real URL location for redirects. Example url: http://sitename.com/go.php?urlid=3 PHP Code:
<?php
/* Function get hidden link */ function get_hidden($hiddenlink){ $info = parse_url($hiddenlink); /* www.hostname.com */ $fp = fsockopen ($info['host'], '80', $errno, $errstr, 30); if ($fp){ /* /pagename.php?id=3 */ $query = "GET /$info[path]?$info[query] HTTP/1.1\r\n"; /* www.hostname.com */ $query .= "Host: $info[host]\r\n\r\n"; fputs($fp, $query); while (!feof($fp)){ $buffer .= fgets($fp,128); } fclose ($fp); } else { return NULL; }
preg_match("/Location: (.+)\n/U", $buffer, $url); $buffer = NULL; return str_replace("\r",'',$url[1]); }
$real_link = ('http://www.hotscripts.com/jump.php?listing_id=46675&jump_type=0');
?> |
| |