<?
echo "Working...<br>";
$grabfile[2]="";
$resource_url = "
http://images.habbogroup.com/dcr/hof_furni/";
$local_file_path = "/swfs/test";
$ch = curl_init("
http://hotel-us.habbo.com/gamedata/furnidata");
$fh = fopen("furnidata.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fh);
curl_exec($ch);
curl_close($ch);
$file = file('furnidata.txt');
$patterns = array();
$patterns[0] = "[[";
$replacements = array();
$replacements[0] = "";
$furni = str_replace($patterns, $replacements, $file);
$furni = implode("],[", $furni);
$furni = explode("],[", $furni);
$i=0;
while($i < count($furni)) {
//echo $furni[$i]."<br>";
$grabfile = explode(",", $furni[$i]);
$temPgf = $grabfile[2];
if (strpos($furni[$i],'*')) {
echo "Skipping ".$temPgf."<br>";
} else {
$revision = $grabfile[3];
$revision = str_replace('"', '', $revision);
$fileput = $local_file_path."/".$revision;
$str_a = $revision."/".$temPgf;
$str_b = str_replace('"', '', $str_a).".swf";
$str = $resource_url.$str_b;
if (!is_dir($fileput)) {
mkdir($fileput, 0, true);
echo "Directory ".$fileput." made.<br>";
} else {
echo "Directory ".$fileput." exists.<br>";
}
echo "Checking.. ".$str."<br>";
$path = $local_file_path."/".$str_b;
if (file_exists($path) == true) {
echo "The file $path exists. ~Trying next file..<br>";
} else {
$fp = fopen($path, 'w');
$ch = curl_init($str);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
curl_close($ch);
fclose($fp);
echo "Grabbed: ".$temPgf."<br>";
}
}
$i++;
}
echo "Finished!";
?>