.+\(#iU', file_get_contents($showurl), $title); if ($show == 'sopranos') { $show= "The Sopranos"; } //Hack to fix Sopranos title grab else { $show = trim(substr($title[0], 7, -2), " :\n\t\r!"); } //Parse and split up epguides content $subject = file_get_contents($showurl); $pattern = '#([0-9]{1,3}\.)(\s+)([0-9]{1,2}\-[\s]?[0-9 ]{1,2})(\s+)([0-9a-zA-Z\s-]+)(\s+)([0-9]{1,2}[\s]?[a-zA-Z]{3}[\s]?[0-9]{2})(\s+)( $thisyear){ $episodedateyear = "19".substr($value['date'], -2,2); } //Echo out the event $value['url'] = str_replace(" &", "&", $value['url']); if ( ctype_digit($episodedateyear) && ctype_digit($episodedatemonth) && ctype_digit($episodedateday)){ echo "BEGIN:VEVENT\r\n"; echo "DESCRIPTION:".$show." - ".$episodeseason."x".$episodenumber.": ". $value['url']."\r\n"; echo "DTEND:".$episodedateyear.$episodedatemonth.$episodedateday."\r\n"; echo "DTSTAMP:".$episodedateyear.$episodedatemonth.$episodedateday."T000000Z\r\n"; echo "DTSTART:".$episodedateyear.$episodedatemonth.$episodedateday."\r\n"; echo "SUMMARY:".$show." - ".$episodeseason."x".$episodenumber." - ".$value['url']."\r\n"; echo "UID:".str_replace(" ", "_", $show)."_".$episodeseason."x".$episodenumber."@epguides.com\r\n"; echo "END:VEVENT\r\n"; } } echo "END:VCALENDAR"; ?>