Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace App\Controllers; use Core\App; use Core\Curl; use Core\Cacher; us..

Decoded Output download

<?php 
 
namespace App\Controllers; 
 
use Core\App; 
use Core\Curl; 
use Core\Cacher; 
use DiDom\Document; 
use DiDom\Query; 
 
 
class BaseController 
{ 
    protected $last; 
    protected $sitemap; 
 
    public function __construct() 
    { 
        $this->last = date('Y_m_d@h_i_s'); 
    } 
 
 
    public function index() 
    { 
        $autodoc_main = App::get('database')->select('autodoc_main', [], [], 'LIMIT 220'); 
       
        $last = $this->last; 
        return view('base-index', compact('last')); 
    } 
 
 
    public function zzap() 
    { 
 
        $dir = INC_ROOT . './data/zzap/'; 
        $files = array_diff(scandir($dir), ['..', '.']); 
        $users = []; 
        foreach ($files as $k_ => $v_) { 
            $read = file_get_contents(INC_ROOT . "/data/zzap/{$v_}"); 
            if (preg_match_all('~<loc>([\s\S]*?)<\/loc>~im', $read, $data)) { 
                foreach ($data[1] as $k__ => $v__) { 
                    if (preg_match('~code_user~im', $v__)) { 
                         
                        var_dump($v_); 
                        var_dump($v__); die; 
                    } 
                    //file_put_contents(INC_ROOT . '/data/zzap/url.log', $v__ . "
", FILE_APPEND); 
                } 
            } 
        } 
 
        die('finish'); 
        $this->sitemap = 'https://www.zzap.ru/sitemap.xml'; 
        $service = new Curl('zzap'); 
        $response = $service->call($this->sitemap); 
        if ($response['info']['http_code'] == 200) { 
            $i = 1; 
            if (preg_match_all('~<loc>([\s\S]*?)<\/loc>~im', $response['content'], $data)) { 
                foreach ($data[1] as $k_ => $v_) { 
                    $ext = explode('.', $v_); 
                    $ext = array_pop($ext); 
                    $get_sitemap = $service->call($v_); 
                    if ($get_sitemap['info']['http_code'] == 200) { 
                        switch ($ext) { 
                            case 'xml': 
                                $dot = 'xml'; 
                                file_put_contents(INC_ROOT . "/data/zzap/sitemap{$i}.$dot", $get_sitemap['content']); 
                                break; 
                            case 'gz': 
                                $dot = 'xml'; 
                                $ecode = gzdecode($get_sitemap['content']); 
                                file_put_contents(INC_ROOT . "/data/zzap/sitemap{$i}.$dot", $ecode); 
                                break; 
                            default: 
                                $dot = 'gzl'; 
                                file_put_contents(INC_ROOT . "/data/zzap/sitemap{$i}.$dot", $get_sitemap['content']); 
                                break; 
                        } 
                    } else { 
                        App::get('loger')->write("ERROR GET SITEMAP", 'zzap-errors-sm.log', true); 
                    } 
                    $i++; 
                    usleep(3000); 
                } 
            } 
        } else { 
            App::get('loger')->write("ERROR 404", 'zzap-errors.log', true); 
        } 
    } 
 
 
    public function autopro() 
    { 
 
        $filename =  INC_ROOT . '/data/autopro_url.log'; 
         
        if (file_exists($filename)) { 
            $f = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); 
            $na = []; 
            foreach ($f as $k_ => $v_) { 
                if (preg_match('~seller~im', $v_)) { 
                    $na[] = $v_; 
                } 
            } 
            $unique = array_unique($na); 
            sort($unique); 
        } 
 
        $document = new Document(); 
 
        if (!empty($unique)) { 
            foreach ($unique as $k__ => $v__) { 
                $service = new Curl('autopro'); 
                $response = $service->call($v__); 
                //$response = $service->call('http://avto.pro/seller/parts-lr-com/'); 
                if ($response['info']['http_code'] == 200 && $response['content'] !== false) { 
                    $document->loadHtml($response['content']); 
                    if (count($store = $document->find('.store')) > 0) { 
                        foreach ($store as $k___ => $v___) { 
                            $desc = ''; 
                            if (preg_match('~<div class="framedblock" itemprop="description" style="overflow:overlay;">([\s\S]*?)<\/div>~im', $response['content'], $matches)) { 
                                $desc = strip_tags($matches[1]); 
                            } 
 
                            $title = ''; 
                            if (preg_match('~<span itemprop=\"name\">([\s\S]*?)<\/span~im', $v___->innerHtml(), $matches)) { 
                                $title = trim($matches[1]); 
                            } 
                            $cat = ''; 
                            if (count($lcat = $document->find('.framedblock.framedblock-sm.framedblock-default.no-margin li')) > 0) { 
                                foreach ($lcat as $kcat => $vcat) { 
                                    $cat .= $vcat->text() . '|'; 
                                } 
                                if ($cat{strlen($cat)-1} == '|') { 
                                    $cat = substr($cat,0,-1); 
                                } 
                         
                            } 
                            $href = ''; 
                            if (count($lhref = $document->find('h5 small a')) > 0) { 
 
                                foreach ($lhref as $khref => $vhref) { 
                                    if (trim($vhref->text()) == '  ') { 
                                        $href = trim($vhref->getAttribute('href')); 
                                    } 
                                } 
                            } 
 
                            $email = ''; 
                            if (preg_match_all('~href=\"mailto\:([\s\S]*?)\"~im', $v___->innerHtml(), $matches)) { 
                                foreach ($matches[1] as $k123 => $v123) { 
                                    $email .= trim($v123) . '|'; 
                                } 
                                if ($email{strlen($email)-1} == '|') { 
                                    $email = substr($email,0,-1); 
                                } 
                            } 
                            $phone = ''; 
                            if (preg_match_all('~href=\"tel\:([\s\S]*?)\"~im', $v___->innerHtml(), $matches)) { 
                                foreach ($matches[1] as $k234 => $v234) { 
                                    $phone .= trim($v234) . '|'; 
                                } 
                                if ($phone{strlen($phone)-1} == '|') { 
                                    $phone = substr($phone,0,-1); 
                                } 
                            } 
                            $address = ''; 
                            if (count($laddress = $document->find('h5 span')) > 0) { 
                                $clearArray = array("
", "
", "
"); 
                                $address = strip_tags(trim($laddress[0]->text())); 
                                $address = str_replace(' ', '', $address); 
                                $address = str_replace('  ', '', $address); 
                                $address = str_replace($clearArray, ' ', $address); 
                                $address = trim($address); 
                            } 
 
                            $inter_info = ''; 
                            if (count($linter = $document->find('.js-store_contact h5')) > 0) { 
                                $inter_info = strip_tags(trim($linter[0]->text())); 
                                 
                            } 
 
                            App::get('database')->insert('avtopro_base', [ 
                                'title' => $title, 
                                'info' => $desc, 
                                'url' => $v__, 
                                'href' => $href, 
                                'category' => $cat, 
                                'address' => $address, 
                                'phone' => $phone, 
                                'email' => $email, 
                                'domain' => 'avtopro', 
                                'inter_info' => $inter_info, 
                                'date' => date('Y-m-d H:i:s'), 
                            ]); 
 
                        } 
                        sleep(1); 
                    } else { 
                    	file_put_contents(INC_ROOT . '/data/autopro.log', $v__ . "
", FILE_APPEND); 
                        App::get('loger')->write($v__, 'autopro-errors-shop.log', true); 
                    } 
                } else { 
                    App::get('loger')->write($v__, 'autopro-errors-200.log', true); 
                } 
            } 
        } else { 
            die('finish'); 
        } 
        die('finish'); 
        $service = new Curl('yandex'); 
 
        for ($i=0; $i < 100; $i++) {  
            $this->sitemap = "https://yandex.ru/search/?text=site%3Aavto.pro%20%22%D0%A0%D0%B5%D0%B9%D1%82%D0%B8%D0%BD%D0%B3%20%D0%BF%D1%80%D0%BE%D0%B4%D0%B0%D0%B2%D1%86%D0%B0%22&lr=213&p={$i}"; 
 
            $service = new Curl('autopro'); 
            $service->setProxy(); 
            $response = $service->call($this->sitemap); 
            if ($response['info']['http_code'] == 200 && $response['content'] !== false) { 
                $data = []; 
                if (preg_match_all('~class=\"link organic__url [\s\S]*?href="([\s\S]*?)"~im', $response['content'], $matches)) { 
                    $data = $matches[1]; 
                } else { 
                    App::get('loger')->write("https://yandex.ru/search/?text=site%3Aavto.pro%20%22%D0%A0%D0%B5%D0%B9%D1%82%D0%B8%D0%BD%D0%B3%20%D0%BF%D1%80%D0%BE%D0%B4%D0%B0%D0%B2%D1%86%D0%B0%22&lr=213&p={$i}", 'autopro-errors-preg.log', true); 
                } 
                if (count($data)) { 
                    foreach ($data as $k_ => $v_) { 
                        file_put_contents(INC_ROOT . '/data/autopro_url.log', $v_ . "
", FILE_APPEND); 
                    } 
                } 
                usleep(3000); 
            } else { 
                App::get('loger')->write("https://yandex.ru/search/?text=site%3Aavto.pro%20%22%D0%A0%D0%B5%D0%B9%D1%82%D0%B8%D0%BD%D0%B3%20%D0%BF%D1%80%D0%BE%D0%B4%D0%B0%D0%B2%D1%86%D0%B0%22&lr=213&p={$i}", 'autopro-errors-200.log', true); 
            } 
        } 
         
    } 
} ?>

Did this file decode correctly?

Original Code

<?php

namespace App\Controllers;

use Core\App;
use Core\Curl;
use Core\Cacher;
use DiDom\Document;
use DiDom\Query;


class BaseController
{
    protected $last;
    protected $sitemap;

    public function __construct()
    {
        $this->last = date('Y_m_d@h_i_s');
    }


    public function index()
    {
        $autodoc_main = App::get('database')->select('autodoc_main', [], [], 'LIMIT 220');
      
        $last = $this->last;
        return view('base-index', compact('last'));
    }


    public function zzap()
    {

        $dir = INC_ROOT . './data/zzap/';
        $files = array_diff(scandir($dir), ['..', '.']);
        $users = [];
        foreach ($files as $k_ => $v_) {
            $read = file_get_contents(INC_ROOT . "/data/zzap/{$v_}");
            if (preg_match_all('~<loc>([\s\S]*?)<\/loc>~im', $read, $data)) {
                foreach ($data[1] as $k__ => $v__) {
                    if (preg_match('~code_user~im', $v__)) {
                        
                        var_dump($v_);
                        var_dump($v__); die;
                    }
                    //file_put_contents(INC_ROOT . '/data/zzap/url.log', $v__ . "\n", FILE_APPEND);
                }
            }
        }

        die('finish');
        $this->sitemap = 'https://www.zzap.ru/sitemap.xml';
        $service = new Curl('zzap');
        $response = $service->call($this->sitemap);
        if ($response['info']['http_code'] == 200) {
            $i = 1;
            if (preg_match_all('~<loc>([\s\S]*?)<\/loc>~im', $response['content'], $data)) {
                foreach ($data[1] as $k_ => $v_) {
                    $ext = explode('.', $v_);
                    $ext = array_pop($ext);
                    $get_sitemap = $service->call($v_);
                    if ($get_sitemap['info']['http_code'] == 200) {
                        switch ($ext) {
                            case 'xml':
                                $dot = 'xml';
                                file_put_contents(INC_ROOT . "/data/zzap/sitemap{$i}.$dot", $get_sitemap['content']);
                                break;
                            case 'gz':
                                $dot = 'xml';
                                $ecode = gzdecode($get_sitemap['content']);
                                file_put_contents(INC_ROOT . "/data/zzap/sitemap{$i}.$dot", $ecode);
                                break;
                            default:
                                $dot = 'gzl';
                                file_put_contents(INC_ROOT . "/data/zzap/sitemap{$i}.$dot", $get_sitemap['content']);
                                break;
                        }
                    } else {
                        App::get('loger')->write("ERROR GET SITEMAP", 'zzap-errors-sm.log', true);
                    }
                    $i++;
                    usleep(3000);
                }
            }
        } else {
            App::get('loger')->write("ERROR 404", 'zzap-errors.log', true);
        }
    }


    public function autopro()
    {

        $filename =  INC_ROOT . '/data/autopro_url.log';
        
        if (file_exists($filename)) {
            $f = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
            $na = [];
            foreach ($f as $k_ => $v_) {
                if (preg_match('~seller~im', $v_)) {
                    $na[] = $v_;
                }
            }
            $unique = array_unique($na);
            sort($unique);
        }

        $document = new Document();

        if (!empty($unique)) {
            foreach ($unique as $k__ => $v__) {
                $service = new Curl('autopro');
                $response = $service->call($v__);
                //$response = $service->call('http://avto.pro/seller/parts-lr-com/');
                if ($response['info']['http_code'] == 200 && $response['content'] !== false) {
                    $document->loadHtml($response['content']);
                    if (count($store = $document->find('.store')) > 0) {
                        foreach ($store as $k___ => $v___) {
                            $desc = '';
                            if (preg_match('~<div class="framedblock" itemprop="description" style="overflow:overlay;">([\s\S]*?)<\/div>~im', $response['content'], $matches)) {
                                $desc = strip_tags($matches[1]);
                            }

                            $title = '';
                            if (preg_match('~<span itemprop=\"name\">([\s\S]*?)<\/span~im', $v___->innerHtml(), $matches)) {
                                $title = trim($matches[1]);
                            }
                            $cat = '';
                            if (count($lcat = $document->find('.framedblock.framedblock-sm.framedblock-default.no-margin li')) > 0) {
                                foreach ($lcat as $kcat => $vcat) {
                                    $cat .= $vcat->text() . '|';
                                }
                                if ($cat{strlen($cat)-1} == '|') {
                                    $cat = substr($cat,0,-1);
                                }
                        
                            }
                            $href = '';
                            if (count($lhref = $document->find('h5 small a')) > 0) {

                                foreach ($lhref as $khref => $vhref) {
                                    if (trim($vhref->text()) == '  ') {
                                        $href = trim($vhref->getAttribute('href'));
                                    }
                                }
                            }

                            $email = '';
                            if (preg_match_all('~href=\"mailto\:([\s\S]*?)\"~im', $v___->innerHtml(), $matches)) {
                                foreach ($matches[1] as $k123 => $v123) {
                                    $email .= trim($v123) . '|';
                                }
                                if ($email{strlen($email)-1} == '|') {
                                    $email = substr($email,0,-1);
                                }
                            }
                            $phone = '';
                            if (preg_match_all('~href=\"tel\:([\s\S]*?)\"~im', $v___->innerHtml(), $matches)) {
                                foreach ($matches[1] as $k234 => $v234) {
                                    $phone .= trim($v234) . '|';
                                }
                                if ($phone{strlen($phone)-1} == '|') {
                                    $phone = substr($phone,0,-1);
                                }
                            }
                            $address = '';
                            if (count($laddress = $document->find('h5 span')) > 0) {
                                $clearArray = array("\r\n", "\r", "\n");
                                $address = strip_tags(trim($laddress[0]->text()));
                                $address = str_replace(' ', '', $address);
                                $address = str_replace('  ', '', $address);
                                $address = str_replace($clearArray, ' ', $address);
                                $address = trim($address);
                            }

                            $inter_info = '';
                            if (count($linter = $document->find('.js-store_contact h5')) > 0) {
                                $inter_info = strip_tags(trim($linter[0]->text()));
                                
                            }

                            App::get('database')->insert('avtopro_base', [
                                'title' => $title,
                                'info' => $desc,
                                'url' => $v__,
                                'href' => $href,
                                'category' => $cat,
                                'address' => $address,
                                'phone' => $phone,
                                'email' => $email,
                                'domain' => 'avtopro',
                                'inter_info' => $inter_info,
                                'date' => date('Y-m-d H:i:s'),
                            ]);

                        }
                        sleep(1);
                    } else {
                    	file_put_contents(INC_ROOT . '/data/autopro.log', $v__ . "\n", FILE_APPEND);
                        App::get('loger')->write($v__, 'autopro-errors-shop.log', true);
                    }
                } else {
                    App::get('loger')->write($v__, 'autopro-errors-200.log', true);
                }
            }
        } else {
            die('finish');
        }
        die('finish');
        $service = new Curl('yandex');

        for ($i=0; $i < 100; $i++) { 
            $this->sitemap = "https://yandex.ru/search/?text=site%3Aavto.pro%20%22%D0%A0%D0%B5%D0%B9%D1%82%D0%B8%D0%BD%D0%B3%20%D0%BF%D1%80%D0%BE%D0%B4%D0%B0%D0%B2%D1%86%D0%B0%22&lr=213&p={$i}";

            $service = new Curl('autopro');
            $service->setProxy();
            $response = $service->call($this->sitemap);
            if ($response['info']['http_code'] == 200 && $response['content'] !== false) {
                $data = [];
                if (preg_match_all('~class=\"link organic__url [\s\S]*?href="([\s\S]*?)"~im', $response['content'], $matches)) {
                    $data = $matches[1];
                } else {
                    App::get('loger')->write("https://yandex.ru/search/?text=site%3Aavto.pro%20%22%D0%A0%D0%B5%D0%B9%D1%82%D0%B8%D0%BD%D0%B3%20%D0%BF%D1%80%D0%BE%D0%B4%D0%B0%D0%B2%D1%86%D0%B0%22&lr=213&p={$i}", 'autopro-errors-preg.log', true);
                }
                if (count($data)) {
                    foreach ($data as $k_ => $v_) {
                        file_put_contents(INC_ROOT . '/data/autopro_url.log', $v_ . "\n", FILE_APPEND);
                    }
                }
                usleep(3000);
            } else {
                App::get('loger')->write("https://yandex.ru/search/?text=site%3Aavto.pro%20%22%D0%A0%D0%B5%D0%B9%D1%82%D0%B8%D0%BD%D0%B3%20%D0%BF%D1%80%D0%BE%D0%B4%D0%B0%D0%B2%D1%86%D0%B0%22&lr=213&p={$i}", 'autopro-errors-200.log', true);
            }
        }
        
    }
}

Function Calls

None

Variables

None

Stats

MD5 d272a81877f7075fa8433aae106f1c94
Eval Count 0
Decode Time 91 ms