<?php
require_once 'sys/sys.php';
#########################################################
# #
# #
# AUTHOR: elon mask #
# #
# #
#########################################################
$id = $_GET['id'];
$url = $url.''.$id;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);//смотрим заголовки
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);//следуем за редиректом.
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux i686; U; en; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 Opera 10.51');
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$content = curl_exec($ch);
curl_close($ch);
// Определяем позицию строки, до которой нужно все отрезать
$pos = strpos($content, '<div class="str">');
//Отрезаем все, что идет до нужной нам позиции
$content = substr($content, $pos);
// Точно таким же образом находим позицию конечной строки
$pos = strpos($content, '<div class="title">Реклама');
// Отрезаем нужное количество символов от нулевого
$content = substr($content, 0, $pos);
//если в тексте встречается текст, который нам не нужен, вырезаем его
$content = str_replace('http://imxab.ru/video','video.php?id=video', $content);
$content = str_replace('http://imxab.ru/categories','cat.php?id=categories', $content);
$content = str_replace('<a href="http://imxab.ru/">Новые</a>','<a href="/">Новые</a>', $content);
$content = str_replace('<a href="http://imxab.ru/','<a href="/dop.php?id=', $content);
$content = preg_replace('|<div class="menu">(.*?)<div class="title">|is', '<div class="title">', $content);//вырезаем рекламу сверху
preg_match_all('|<h1>(.*?)</|is', $content, $adv);
for ($i = 0; $i <= count($adv[0]); $i++) {
$ads = $adv[0][$i];
$ads = str_replace('<h1>','', $ads);
$ads = str_replace('</','', $ads);
$title = $ads;
$description = 'Просмотр категории '.$title;
require_once 'sys/head.php';
}
echo $content;
require_once 'sys/foot.php';
?>