P粉3950561962023-08-09 09:33:30
You try this
<?php $code = file_get_contents("offer.php"); $pattern_get = '/isset\($_GET\[\'(.*?)\'\]/'; $pattern_value = '/$_GET\[\'(.*?)\'\]\s*==\s*"(.*?)"/'; preg_match_all($pattern_get, $code, $matches_get, PREG_SET_ORDER); preg_match_all($pattern_value, $code, $matches_value, PREG_SET_ORDER); $getValues = []; $values = []; foreach ($matches_get as $match) { $getValues[] = $match[1]; } foreach ($matches_value as $match) { $values[] = $match[2]; } print_r($getValues); print_r($values); // Creating separate URLs for each $_GET variable and value for ($i = 0; $i < count($getValues); $i++) { $url = 'example.com/?' . $getValues[$i] . '=' . $values[$i]; echo $url . '<br>' . PHP_EOL; } ?>