'; $str .= ''; $str .= ''; $str .= ''; $str .= 'URL'; $str .= '' . $encoded_url . ''; $str .= ''; $str .= ''; file_put_contents($path, $str); clearCache(); } # Find the *.webloc file, if in, in the provided folder function findWebloc($path) { $retval = false; $dir = opendir($path); if ($dir === FALSE) { die('Unable to opendir(): ' . htmlspecialchars($path) . "\n"); } while (false !== ($name = readdir($dir))) { # Skip junk if (isJunk($name)) { continue; } # We only care about *.webloc files if (!preg_match('/\.webloc$/', $name)) { continue; } # The file must be readable to be useful $file = $path . '/' . $name; if (is_readable($file)) { $retval = $file; last; } } closedir($dir); return $retval; } # Read and parse the provided *.webloc file function readWebloc($file) { $str = trim(file_get_contents($file)); return parseTVDBURL($str); } ?>