Привет всем! могли бы вы мне помочь? как средствами PHP с помощью регулярного выражения вытянуть с страницы все поля hidden <input type="hidden" name="mod" value="addnews" /><input type="hidden" name="ptxfuhkk" value="84a1097b837ba10296c43d16353ca43a" /> чтоб было так $h1='mod = addnews'; $h2='ptxfuhkk = 84a1097b837ba10296c43d16353ca43a'; заранее спасибо!!!
PHP: <? $string = "<input type="hidden" name="mod" value="addnews" /><input type="hidden" name="ptxfuhkk" value="84a1097b837ba10296c43d16353ca43a" />" preg_match_all("/<input type=\"hidden\" name=\"(.*?)\" value=\"(.*?)\" \/>/",$string,$match) print_r($match) ?>
PHP: <? $from='<input type="hidden" name="mod" value="addnews" /><input type="hidden" name="ptxfuhkk" value="84a1097b837ba10296c43d16353ca43a" />'; preg_match_all('|type="hidden" name="(.*?)" value="(.*?)"|is', $from, $out); for ($i=0; $i<count($out[1]); $i++) { $per[$i] = "{$out[1][$i]} = {$out[2][$i]}"; echo "{$out[1][$i]} = {$out[2][$i]}<br>"; } ?> В массив $per будет писаться то, то тебе нужно, и на экран выводиться.