$exchang = // сюда скопируйте массив из OmLL0Imx.js, он в самом начале файла лежит
$sourcePath = "OmLL0Imx.js";
$source = file_get_contents($sourcePath);
$limit = -1;
$count = 5;
$result = preg_replace_callback
(
"#(_0x2ee1\[(\d+)\])#si",
function($matches) use ($exchang)
{
return $exchang[$matches[2]];
},
$source
);
file_put_contents(__DIR__."/result.txt", $result);
echo "Job done";
$data = '
<script>
var isProductPage = true;
var Name = "Coll dress";
var brandName = "Dress 123";
var gender = "Womens";
</script>
';
function changeValue($data, $someVar)
{
return preg_replace_callback
(
"#var\s(.*?)\s=\s(.*?);#",
function($matches) use ($someVar)
{
return ($matches[1] == $someVar["varName"]) ?
preg_replace("#".$matches[2]."#", $someVar["newValue"], $matches[0]) :
$matches[0];
},
$data
);
}
$someChanges = array
(
array("varName" => "isProductPage", "newValue" => "false"),
array("varName" => "gender", "newValue" => "\"Mens\"")
);
$data = changeValue($data, $someChanges[0]);
$data = changeValue($data, $someChanges[1]);
echo $data;