', $html); // arrayFull is the page with the header elements stripped array_shift($arrayFull); // arrayFull has now had the bits before the events template removed $i = count($arrayFull); // $i now corresponds to the key of the final element +1 $j = $i-1; // set the number for the final bit $final = $arrayFull["$j"]; // extract the final event - will deal with this in a minute array_splice($arrayFull, "$j"); // remove the final event from arrayFull and discard // now split "final" and remove all the stuff from the end $clean = explode('
', $final); // remove the *last* element from clean and discard: array_splice($clean, 1); // finally we stitch it all back into one array which is *just* the clean events table ready to parse $merged = array_merge($arrayFull, $clean); // $merged is now ready for us to do something with it. // set some iteration variables so we can count through $iter = 0; foreach ($merged as $event) { // make array of times if (eregi('', $event, $match)); { array_shift($match); foreach ($match as $time) { $position_event = strpos($time, '"'); $time_final = substr_replace($time, '', $position_event); $month = substr($time_final, 0, 2); $day = substr($time_final, 3, 2); $year = substr($time_final, 6, 4); $hour = substr($time_final, 11, 2); $minute = substr($time_final, 14,2); $unix = mktime($hour,$minute,'00',$month,$day,$year); // $rfc = date(r, $unix); $time_array[$iter] = $unix; } } // make array of cities if (eregi('', $event, $match)) { array_shift($match); foreach ($match as $city) { $position = strpos($city, '"'); $city_final = htmlspecialchars(substr_replace($city, '', $position)); $city_array[$iter] = $city_final; } } // make array of location/venue if (eregi('', $event, $match)); { array_shift($match); foreach ($match as $venue) { $position_venue = strpos($venue, '"'); $venue_final = htmlspecialchars(substr_replace($venue, '', $position_venue)); $venue_clean = ereg_replace('é', 'e', $venue_final); $venue_array[$iter] = $venue_clean; } } // make array of street if (eregi('', $event, $match)); { array_shift($match); foreach ($match as $street) { $position_street = strpos($street, '"'); $street_final = htmlspecialchars(substr_replace($street, '', $position_street)); $street_array[$iter] = $street_final; } } // make array of description if (eregi('

(.*)', $event, $match)); { array_shift($match); foreach ($match as $description) { $description_array[$iter] = htmlspecialchars(preg_replace('([\n])', '
', $description)); } } $iter++; } // now take each value in turn and present it: $event_number = count($merged); // set event number - remember first value is 0! $f = 0; // will use $f to count the number of times through we are. // start with the RSS headers print ''; print 'Clara Kousah showsClara Kousah eventshttp://www.clarakousah.com/gigs'; while ($f < $event_number) { print "\n"; print "" . $venue_array[$f] . " - " . $street_array[$f] . "," . $city_array[$f] . "\n"; print "" . $description_array[$f] . "\n"; print "" . $time_array[$f] . "\n"; print "" . htmlspecialchars($url) . "\n"; print "\n"; $f++; } print ''; } readPage ('http://collect.myspace.com/index.cfm?fuseaction=bandprofile.listAllShows&friendid=41827648&n=Clara+Kousah'); ?>