59 lines
1.3 KiB
PHP
Executable File
59 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
ini_set('display_errors', 0);
|
|
|
|
|
|
|
|
|
|
|
|
function ekr($text)
|
|
{ // ФУНКЦИЯ очистки кода
|
|
|
|
$old1 = array("data-price=", 'class="lazyload"');#Ищем вредное ">",, "<"
|
|
|
|
$new1 = array("src=", 'class="yurecnt"');#Меняем на полезное">", , "<"
|
|
|
|
$text = str_replace($old1, $new1, $text);#Собсно сама замена =)
|
|
|
|
return $text;
|
|
}
|
|
|
|
|
|
|
|
|
|
//echo ekr($html);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$entry = $doc->find('.content-description');
|
|
$opis = pq($entry)->html();
|
|
\DB::set("UPDATE `tovar` SET `txt`=? WHERE `id`=?", array($opis, $_GET['id']));
|
|
|
|
|
|
$entry = $doc->find('[type=application/ld+json]');
|
|
$json = pq($entry)->text();
|
|
$massiv = core::j($json);
|
|
|
|
//print_r($massiv);
|
|
|
|
$fm = core::genpassword(30);
|
|
mkdir('/www/core/img/tavrnt.ru/tovar/' . $_GET['id'], 0777);
|
|
|
|
$tip = pathinfo($massiv['image'], PATHINFO_EXTENSION);
|
|
|
|
exec("wget -O /www/core/img/tavrnt.ru/tovar/" . $_GET['id'] . '/' . $fm . '.' . $tip . ' ' . $massiv['image']);
|
|
|
|
if (file_exists("/www/core/img/tavrnt.ru/tovar/" . $_GET['id'] . '/' . $fm . '.' . $tip))
|
|
DB::add("INSERT INTO `img` (`filename`, `content_type`, `content_id`, `site`, `tip`) VALUES (?,?,?,?,?)", array($fm, 'tovar', $_GET['id'], 'tavrnt.ru', $tip));
|
|
//DB::set("UPDATE `tovar` SET `status`=? WHERE `id`=?", array(1, $tovar[$i]['id']));
|
|
|
|
//print_r($data['list']);
|
|
|
|
|
|
?>
|