Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   вытянуть с страницы все поля hidden (https://forum.antichat.xyz/showthread.php?t=114572)

Student :) 05.04.2009 12:54

вытянуть с страницы все поля hidden
 
Привет всем!
могли бы вы мне помочь? как средствами PHP
с помощью регулярного выражения вытянуть с страницы все поля hidden

<input type="hidden" name="mod" value="addnews" /><input type="hidden" name="ptxfuhkk" value="84a1097b837ba10296c43d16353ca43a" />

чтоб было так
$h1='mod = addnews';
$h2='ptxfuhkk = 84a1097b837ba10296c43d16353ca43a';

заранее спасибо!!!

Vid0k 05.04.2009 13:04

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)


?>


wildshaman 05.04.2009 13:05

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 будет писаться то, то тебе нужно, и на экран выводиться.

Student :) 05.04.2009 13:06

спасибо щас потестим


Время: 20:35