I am attempting to parse an html page but running into problems. The purpose of the parse is to create a program guide for tv programs. I am able to parse each channel, each program, program time and program description but can't seem to get it all together. Meaning I can't get the correct channel with only that channel's shows, time and description into a single array. Here is the php. I will have to post the html example separate, as I keep getting flagged when trying to post it with this post.
Code:
$images= $dom->getElementsByTagName('img');
foreach($images as $img){
$icon= $img ->getAttribute('src');
if( preg_match('/\.(jpg|jpeg|gif)(?:[\?\#].*)?$/i', $icon) ) { //only matching types
$channel[]=$img->getAttribute('alt');
}
}
foreach ($childprogram as $programname)
{
$showname[]=$programname->nodeValue;
}
foreach($childtime as $programtime){
$showtime[]=$programtime->nodeValue;
}
foreach($childdescrip as $programdescrip){
$showdescrip[]=$programdescrip->nodeValue;
}
Comment