HEX
Server: Apache/2.4.46 (Unix) PHP/7.4.24
System: Linux dc15-w.ht-systems.ru 2.6.32-042stab142.1 #1 SMP Tue Jan 28 23:44:17 MSK 2020 x86_64
User: srv52894 (52894)
PHP: 7.4.24
Disabled: passthru,shell_exec,system,proc_open,popen,show_source
Upload Files
File: /home/srv52894/test/parser.php
<?php
	header('Content-Type: text/javascript');
	$url="http://atis-russia.ru/index.php/ostatki-na-sklade";
	function findData ($s,$startPattern,$endPattern){		
		$cutLength=strlen($startPattern);
		$pos_begin=strpos($s,$startPattern); 
		$s=substr($s,$pos_begin);
		$pos_end=strpos($s,$endPattern);
		$text=substr($s,$cutLength,($pos_end-$cutLength));
		return $text;
	} 
	$patterns = array("/ККБ ACCU-H003L/",
					  "/ККБ ACCU-H004L/",
					  "/ККБ ACCU-H005L/",
					  "/ККБ ACCU-H007L/",
					  "/ККБ ACCU-H011L/",
					  "/ККБ ACCU-H013L/",
					  "/ККБ ACCU-H017L/",
					  "/ККБ ACCU-H022L/",
					  "/ККБ ACCU-H026L/",
					  "/ККБ ACCU - 032L/",
					  "/ККБ ACCU - 045L/",
					  "/ККБ ACCU - 052L/",
					  "/ККБ ACCU- 064 L/",
					  "/ККБ AMCCU-090L/",
					  "/ККБ AMCCU-104L/",
					  "/ККБ AMCCU-129L/",
					  "/ККБ AMCCU-180L/");
	$replasments1 = array("АСК-1",
						  "АСК-1,5",
						  "АСК-2",
						  "АСК-3",
						  "АСК-3,7",
						  "АСК-4,6",
						  "АСК-6",
						  "АСК-8",
						  "АСК-10",
						  "АСК-12",
						  "АСК-15",
						  "АСК-20",
						  "АСК-24",
						  "АСК-30",
						  "АСК-40",
						  "АСК-48",
						  "АСК-60");
	$replasments2 = array("ККБС-1",
						  "ККБС-1,5",
						  "ККБС-2",
						  "ККБС-3",
						  "ККБС-SBP 130",
						  "ККБС-SBP 160",
						  "ККБС-SBP 205",
						  "ККБС-SCP 270",
						  "ККБС-SCP 315",
						  "ККБС-SCP 400",
						  "ККБС-SCP 510",
						  "ККБС-2xSCP 315",
						  "ККБС-2xSCP 400",
						  "ККБС-2xSCP 510",
						  "ККБС-4xSCP 315",
						  "ККБС-4xSCP 400",
						  "ККБС-4xSCP 510");
	$cinit=curl_init();
	curl_setopt($cinit,CURLOPT_URL,$url);
	curl_setopt($cinit,CURLOPT_HEADER,0);
	curl_setopt($cinit,CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
	curl_setopt($cinit,CURLOPT_FOLLOWLOCATION,1);
	curl_setopt($cinit,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($cinit, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($cinit, CURLOPT_SSL_VERIFYHOST, false);
	$text=curl_exec($cinit);
	curl_close($cinit);
	$text=findData($text,'</form>','<span id="mxcpr">');
	$text=substr($text,0,-13);
	$text=str_replace(array("\r\n", "\r", "\n", "\t"), '', $text);
	$text = preg_replace('~>\s+<~', '><', $text);
	$text = preg_replace('~<div class="buttons">.+</div>~U', '', $text);
	$text = preg_replace('~<a\b[^>]*+>|</a\b[^>]*+>~', '', $text);
	if (($_SERVER['REQUEST_METHOD'] == 'GET') && !(empty($_GET['brand'])))
		{
			$text = ($_GET['brand'] == 1)?preg_replace($patterns, $replasments1, $text):preg_replace($patterns, $replasments2, $text);
		echo "document.write('$text');";
		}
?>