Read XML PHP Internal and External -
how read xml?
<?xml version="1.0" encoding="utf-8"?> <response parte="01" total="01"> <style> <color="000000" name="black" status="3" erro="0"/> <color="0000ff" name="blue" status="3" erro="0"/> <color="ff0000" name="red" status="2" erro="0"/> </style> </response> i got see print_r, print lines of color. ex.:
1: 000000 - black - 3 - 0
2: 0000ff - blue - 3 - 0
3: ff0000 - red - 2 - 0
does have idea? thanks.
if not valid xml, have deal output string
$string = '<response parte="01" total="01"> <style> <color="000000" name="black" status="3" erro="0"/> <color="0000ff" name="blue" status="3" erro="0"/> <color="ff0000" name="red" status="2" erro="0"/> </style> </response>'; preg_match_all('/color="(.*?)" name="(.*?)" status="(.*?)" erro="(.*?)"/', $string, $match); unset($match[0]); var_dump($match);
Comments
Post a Comment