Thread: Help with preg_match_all
i dont know right place asking this, need help.
want read xml preg_match_all.
xml structure:
<site>
<st-id>$sitelerl[id]</st-id>
<st-url>$sitelerl[url]</st-url>
<st-puan>$sitelerl[puan]</st-puan>
<st-bayipuan>$sitelerl[bayipuan]</st-bayipuan>
</site>
(this being repeated)
------------------
writed preg_match_all this:
preg_match_all('/<site>(.*?)<\/site>/i',$sonuc,$cikti);
echo $cikti[1][0];
-----------
question need (.*?) repleace can pull data between <site></site> ?????
thank lot.
may advise use php's simplexml?
because, name says, it's simple!
here's sample:
see result at: http://codepad.org/o1chnq5icode:<?php $xml = <<< xml <site> <st-id>a</st-id> <st-url>b</st-url> <st-puan>c</st-puan> <st-bayipuan>d</st-bayipuan> </site> xml; $sxml=new simplexmlelement($xml); var_dump($sxml); echo $sxml->{"st-id"}.php_eol; ?>
advise against parsing yourself.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk [SOLVED] Help with preg_match_all
Ubuntu
Comments
Post a Comment