Файл: inc/tools/shorten/rename.php
Строк: 47
<?php
include("../lib/functions.inc.php");
Error_Reporting(E_ALL & ~E_NOTICE);
function curl($url, $params)
{
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$king=curl_exec ($ch);
curl_close($ch);
return $king;
}
if ($_POST['parse'])
{
$keylist=explode("n", $_POST['key']);
foreach ($keylist as $key)
{
$url=extract_value($key, "<a href=", ">");
$description=extract_value($key, ">", "</a>");
$serviciu=array("urlbounce", "0rz", "mywnc");
//$service=$serviciu[mt_rand(0,2)];
$service="skocz";
switch($service)
{
case "urlbounce":
$params="url=".$url."&submit=Create+URL";
$url="http://urlbounce.com/create/";
$king=curl($url, $params);
$newurl=extract_value($king, "<input name="new_url" type="text" size="70" value="", """);
break;
case "0rz":
$params="url=".urlencode($url);
$url="http://0rz.tw/create.php";
$king=curl($url, $params);
$newurl=extract_value($king, "<a href="", """);
break;
case "mywnc":
$params="ttny=192.168.0.1&theurl=".urlencode($url);
$url="http://mywnc.org/short.php";
$king=curl($url, $params);
$newurl=extract_value($king, "» <a href="", """);
break;
case "skocz":
$params="action=insert&redirurl=".urlencode($url);
$url="http://skocz.pl/";
$king=curl($url, $params);
$newurl=extract_value($king, "target=_blank>", "</a>");
break;
}
echo "<a href=".$newurl.">".$description."</a>n";
flush();
}
}
?>