<?php

 define('_IN_JOHNCMS', 1);
require_once ('../incfiles/core.php');
require_once ('../incfiles/head.php');


function view($url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/27.1176; U; ru) Presto/2.8.119 Version/11.10');
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: text/html, application/xml;q=0.9, application/xhtml xml, image/png, image/jpeg, image/gif,image/x-bitmap, */*;q=0.1', 'Accept-Charset: utf-8;q=0.6 windows-1251;q=0.1*;q=0.1', 'Accept-Encoding: utf-8', 'Accept-Language: ru, en;q=0.9'));
curl_setopt($curl, CURLOPT_AUTOREFERER, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 0);
include_once $SERVER['DOCUMENT_ROOT'].'p.php'; 
$result = curl_exec($curl);
curl_close($curl);
if (!$result){
echo '<div class="menu">
Ошибка, мы уже работаем над её устранением...
</div>';
}
return $result;
}
$i = $_GET['i'];
$q = $_POST['q'];
 
$file=view('http://ism.uz/'.(!empty($i) ? $i : ''));
 $file=preg_replace('#<ol class=women-names(.*)>#sU','<div class="phdr">Qizlar ismi</div>',$file); 
$file=str_replace('href="/','href="?i=',$file);
$file=str_replace("href='","href='?i=",$file);
$file=str_replace('<span>harfidan boshlanadigan ismlar</span>','&nbsp;harfidan boshlanadigan ismlar',$file); 
$file=preg_replace('#<!(.*)>#sU','',$file);

 $file=preg_replace('#<meta(.*)<div class="searchbox">#sU','',$file); 
$file=preg_replace('#<div class="g-row"(.*)<div class="hidden"(.*)</div>#sU','',$file);
 $file=preg_replace('#<div class="content__footer"(.*)</noscript>(.*)</div>#sU','',$file); 
 $file=preg_replace('#<noscript(.*)</noscript>#sU','',$file); 
 $file=preg_replace('#<script(.*)</script>#sU','',$file); 
 $file=preg_replace('#<li(.*)>#sU','',$file); 
 $file=preg_replace('#</li(.*)>#sU','',$file); 
 $file=preg_replace('#<ul(.*)>#sU','',$file); 
 $file=preg_replace('#</ul(.*)>#sU','',$file); 
 $file=preg_replace('#<p(.*)>#sU','',$file); 
 $file=preg_replace('#</p(.*)>#sU','',$file); 
 $file=preg_replace('#<h(.*)>#sU','',$file); 
 $file=preg_replace('#</h(.*)>#sU','',$file); 
 $file=preg_replace('#<small(.*)>#sU','',$file); 
 $file=preg_replace('#</small(.*)>#sU','',$file); 
 $file=preg_replace('#<ol(.*)>#sU','',$file); 
 $file=preg_replace('#</ol(.*)>#sU','',$file); 
 $file=str_replace('<div class="content__header">','<div class="phdr">',$file); 
 $file=preg_replace('#<div class="alphabet-section(.*)>#sU','<div class="menu">',$file); 
 $file=preg_replace('#<div class="names(.*)>#sU','<div class="menu">',$file); 
 $file=preg_replace('#<span(.*)</span>#sU','',$file); 
 $file=preg_replace('#<div class="content-section(.*)<div(.*)<div(.*)>#sU','',$file); 
 $file=preg_replace('#<div class="content__main(.*)>#sU','<div class="menu">',$file); 
 $file=preg_replace('#<div class="cats-section(.*)</div>#sU','',$file); 
 $file=preg_replace('#<div class="content__header(.*)>#sU','<div class="phdr">',$file); 
$file=str_replace('<form action="/search/">','<form action="search/">',$file);
 //$file=str_replace('<input name="q','<input name="i',$file); 
$file=str_replace('</div> </div>','</div>',$file);

 $file=str_replace('bo‘yicha qidiruv natijalari','',$file);
 $file=preg_replace('#<div class="form-control(.*)<div class="popular-searches"(.*)</div>(.*)</div>#sU','<div class="phdr"><b>Alifbo bo\'yicha</b>',$file); 




echo $file; 
require_once ('../incfiles/end.php');
?>
