rendered paste body<?php $buffer = file_get_contents('http://epguides.com/DesperateHousewives/'); // Has Prod # //$buffer = file_get_contents('http://epguides.com/Afterlife/'); // Missing Prod # $output = array(); $recent = null; $current = null; if (preg_match_all('|(\d+)\.[\s]+(\d+)[\s-]+(\d+).*?(\d{1,2})\s(.\w+)\s(\d{2})\s+<a target="_blank" href="(.[^"]+)">(.[^<]+)|', $buffer, $output, PREG_SET_ORDER)) { for ($i = 0; $i < count($output); $i++) { // Create a pointer to the current array $current = &$output[$i]; // Save the date $current['date'] = strtotime($current[4] . ' ' . $current[5] . ' ' . $current[6]); // Compare the date if ( (empty($recent) || ($current['date'] > $recent['date'])) ) { $recent = &$current; } echo $current['date'] . ' - ' . $current[4] . ' ' . $current[5] . ' ' . $current[6] . "<br />\n"; } } print_r($recent);?>