array( 'timeout' => 15 ) )); return @file_get_contents($url, 0, $ctx); } # Plain-text title of a TVDB entity (or FALSE on failure) function getTVDBTitle($id, $lid) { $retval = false; $page = getTVDBPage($id, $lid); if ($page) { if (preg_match('/\([^\>]+)\<\/h1\>/i', $page, $matches)) { $retval = $matches[1]; } } return $retval; } # Get the seasons of a TVDB entity function getTVDBSeasons($id, $lid) { $retval = false; $page = getTVDBPage($id, $lid); if ($page) { if (preg_match_all('/class=\"seasonlink\"[^\>]*\>([^\<]+)\<\/a\>/i', $page, $matches)) { $retval = array(); foreach ($matches[1] as $val) { if (preg_match('/^\d+$/', $val)) { $retval[ $val ] = true; } else if ($val == 'Specials') { $retval[0] = true; } } } } return $retval; } ?>