09-26-2009, 01:10 PM
|
#6 (permalink)
|
|
That guy
Join Date: Sep 2009
Location: San Antonio, TX
Posts: 24
Thanks: 0
|
PHP Code:
<?php
final class Main { protected static $result, $address = null; protected function __construct() {} protected function __clone() {} public static function Prepare($address) { $address = explode('.com/', $address); $address = 'http://preview.tinyurl.com/' . $address[1]; $document = file_get_contents($address); preg_match ('~redirecturl" href="(.*)">~i', $document, $matches); if (isset($matches[1])) return $matches[1]; return null; } public static function Result($address) { if (!isset( self::$address)) { self::$address = self::Prepare($address); } echo "<a href='" . self::$address . "'>" . self::$address . "</a>"; } }
?>
<form action="<?php echo $PHP_SELF;?>" method="post"> <input type="text" name="url" /> <input type="submit" /> </form>
<?php Main::Result($_POST['url']); ?>
Just sayin. 
|
|
|
|