<?php
/*
adf.ly original link generator.
Copyright (C) 2011 Ahlspiess
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('REQUEST', "GET %s HTTP/1.1\r\n".
"Host: %s\r\n".
"Referer: %s\r\n".
"Connection: Close\r\n\r\n");
$data = "";
$c = $_GET['link'];
$parse = parse_url($c);
$fp = @fsockopen($parse['host'], 80, $error_no, $error_msg, 15);
if(!$fp)
{
e("Error: {$error_msg} ({$error_no})");
}
else
{
@fwrite($fp, sprintf(REQUEST, $parse['path'], $parse['host'], $parse['schema'].$parse['host'].$parse['path']));
while(!feof($fp))
{
$data .= @fgets($fp);
}
$data = explode("\r\n\r\n", $data);
preg_match("/var\ url\ =\ \'(.+?)\'\;/", $data[1], $value);
e("{$c} = {$value[1]}");
}
function e($s) {
print $s."\n";
}
?>