<?php
include '../../../connect.php';
include '../../../head.php';
include 'simple_html_dom.php';
include('conf.php');
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,'http://vko.su/?'.$_SERVER['QUERY_STRING'].'');
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1');
curl_setopt($curl, CURLINFO_HEADER_OUT, false);
curl_setopt($curl, CURLOPT_REFERER, "http://vko.su/?");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
if (!empty($_POST[name]))
{
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, "name=".$_POST[name]."&sort=".$_POST[sort]."&code");
}
$res = curl_exec($curl);
$data = new simple_html_dom();
$data->load($res);
curl_close($curl);
if ($data == false)
{
echo '<div class="menu">Сайт временно не работает! Приносим свои извинения!</div>';
exit;
}
$tmp = $data->find('form[action="/"]');
if ($tmp != false)
{
echo '<div class="menu">';
foreach($tmp as $p)
{
$p = preg_replace('|<a href="http://tds.pux.su(.*)</div>|Us','', $p);
$p = preg_replace('|"post"> (.*)Введите|Us','post"> Введите', $p);
$p = str_replace('action="/"','action="index.php"', $p);
$p = str_replace('</div>','', $p);
$p = str_replace('<div class="dv">','', $p);
$p = preg_replace('#<span onclick="(.*)/span>#sU','',$p);
echo $p;
}
echo '</div>';
// Листинг:
$tmp = $data->find('table[border="0"]');
if ($tmp != false)
{
foreach($tmp as $p)
{
echo '<div class="menu">';
$p = preg_replace('|<div class="(.*)">|Us','', $p);
$p = str_replace('</div>','', $p);
$p = str_replace('href="/get/','href="get/', $p);
echo $p;
echo '</div>';
}
}
// Навигация:
$tmp = $data->find('span[class="navigation"]');
if ($tmp != false)
{
$p = str_replace('href="/?','href="?', $tmp[1]);
echo $p;
}
}
$data->clear();
unset($data);
include '../../../foot.php';
?>