<?php
$countries = array('jp', 'us', 'cn', 'kr');
$source_filename_prefix = array('topfree', 'toppaid', 'topgrossing');
foreach ($countries as $country) {
foreach ($source_filename_prefix as $filename_prefix) {
$filename = $country . "_" . $filename_prefix . ".list";
$contents = @file($filename);
foreach ($contents as $line) {
$rss_data = explode("," ,$line);
$category = trim($rss_data[0]);
$xml_url = trim($rss_data[1]);
$output_filename = $country . "/" . $filename_prefix . "_" . $category . "_" . date('Ymd') . ".xml";
$cmd = "wget " . $xml_url . " -O " . $output_filename;
system($cmd);
}
}
}