<?PHP
/*
Download the latest public sitemaps from Hulu
*/
//set_time_limit(0);
include('hulu.class.php');
$hulu = new hulu;
$error = false;
if( !empty($_REQUEST['action']) ){
if( $hulu->fetchSiteMaps() === true ){
echo 'Hulu public sitemap download complete';
}else{
echo 'Script reported a problem:<br>';
echo $hulu->error;
}
}else{
echo '<hr>';
if( is_dir($hulu->dataFolder) ){
echo 'This script will download the public sitemap files from Hulu and save them to the '.$hulu->dataFolder.' folder.<br><br>';
if( is_readable($hulu->dataFolder) ){
echo $hulu->dataFolder.' is readable... check<br>';
}else{
$error = true;
echo 'Error!!! '.$hulu->dataFolder.' is NOT readable... you must set permisions for this folder to be readable.<br>';
}
if( is_writable($hulu->dataFolder) ){
echo $hulu->dataFolder.' is writeable... check<br>';
}else{
$error = true;
echo 'Error!!! '.$hulu->dataFolder.' is NOT writeable... you must set permisions for this folder to be writeable.<br>';
}
}else{
$error = true;
echo 'Error!!! Folder '.$hulu->dataFolder.', to store public sitemap files from Hulu was not found, either create this folder off the location this script is installed, or change the dataFolder property to the correct folder name.<br>';
}
echo '<hr>';
echo 'The sitemap files from Hulu are archived with gz compression.<br><br>';
if( extension_loaded('zlib') ){
echo 'Your installation of PHP has the required zlib extension loaded... check<br>';
}else{
$erro = true;
echo 'Error!!! Your installation of PHP does NOT has the required zlib extension loaded. You will not be able to use this utility to download the sitemaps. Not to worry though, you can go to http://www.hulu.com/pub_sitemap.index.xml?'.$hulu->huluPublicAccessKey.' to get the full list of sitemaps. Manually download and extract the xml files to the the data folder '.$hulu->dataFolder.', then run the method createLastJSON() to index the files.<br>';
}
echo '<hr>';
if( empty($error) ){
echo 'These files are not needed to embed video from Hulu on you site, they are provide by Hulu to create a searchable database. Once downloaded, this script can search the xml files for a specified video ID and return the data for that video or an array of videos that match a search keyword. If you do not need the search capabilities, then there is no need to download or maintain these files.<br><br>';
echo 'These files contain xml formatted data for all the content publicly available on Hulu and may take a few minutes to download, depending on your connection speed. If you timeout, you may need to use set_time_limit(0) by un-commenting that line is this file, fetch_data.php<br><br>';
echo 'Are you sure you want to continue? [<a href="fetch_data.php?action=i_said_do_it">Yes, let\'s do it</a>]';
}else{
echo 'Fix any problems listed above and try again.';
}
}
?>
|