function cacheurl($url, $browser_req = true, $cookies = "", $browser = "Firefox") { global $myconfig; #find cache file $hash = md5($url); $datei = "cache/" . $hash; if (file_exists($datei)) { if (time() - filemtime($datei) < $myconfig['cachetime']) { return implode('', file($datei)); } } #no cache file exists send browser request if ($browser_req == true) { $objekt = new Browser($browser); if ($cookies != "") { $objekt->cookies_set($cookies); } $objekt->url = $url; $t_html = $objekt->read(); } else { $t_html = implode('', file($url)); } d_write($datei, $t_html); return $t_html; }
/** * Parse the video url of a given myvideo video link site * and returns the http url of the video * * * @param string $url * url of video must contain watch/* * http://www.myvideo.de/watch/7125794 * @return string * the url of the video as http url; should the flv file */ function myvideo_flv_download($url) { preg_match('|watch/(\\d+)/|i', $url, $match); $objekt = new Browser($browser); if ($cookies != "") { $objekt->cookies_set($cookies); } $objekt->url = "http://www.myvideo.de/movie/" . $match[1]; $objekt->read(); $head = $objekt->returnHeader(); preg_match('/V\\=(.*?).flv/', $head['Location'], $matches); return urldecode($matches[1]) . ".flv"; }