My file images.html
contains multiple lines with the following code:
<linestart><urlstart>http://...image.jpg<urlend><idstart>1<idend><lineend>
I want to parse the file but I can’t figure out my error.
My PHP code:
$pattern = "/<linestart>(.*?)<lineend>/s";
$html = file_get_contents('images.html');
$check = preg_match_all($pattern,$html,$match);
foreach($match[1] as $line)
{
$pattern2 = "/<urlstart>(.*?)<urlend>/s";
$check2 = preg_match_all($pattern2,$line,$match_url);
$pattern3 = "/<idstart>(.*?)<idend>/s";
$check3 = preg_match_all($pattern3,$line,$match_id);
echo $match_url." id= ".$match_id."<br>";
}
My result is:
Array id= Array
Array id= Array
Array id= Array
Array id= Array
Array id= Array
Array id= Array
Any ideas why?