//default datasetName should be LANDSAT_8 //default datasetName should be LANDSAT_8 default: $datasetName = "LANDSAT_8"; break; } print_r("Downloading " . $row[0]); print_r(" with dataset " . $datasetName); if (file_exists($path_products . $row[0] . '.tar.gz')) { echo "\n The file already exists"; } else { $downloadUrl = getDownloadUrl($datasetName, $client, $apiKey, $row[0]); //check if downlad is available empty string is not available if (empty($downloadUrl->item)) { //if not available order scenes $downloadUrl = getOrderScene($datasetName, $client, $apiKey, $row[0]); //make sure we still got something in case it's just not available for 0 cost. if (empty($downloadUrl->item)) { //nothing available or could not order print_r("\n Could not order products."); } else { //download data once available print_r("\n downloadUrl->item :" . $downloadUrl->item); custom_put_contents($downloadUrl->item, $path_products . $row[0] . '.tar.gz'); } } else { //download if not empty - product is available print_r("\n downloadUrl->item :" . $downloadUrl->item); custom_put_contents($downloadUrl->item, $path_products . $row[0] . '.tar.gz'); } array_push($downloaded_array, $path_products . $row[0] . '.tar.gz');
//default datasetName should be LANDSAT_8 //default datasetName should be LANDSAT_8 default: $datasetName = "LANDSAT_8"; break; } print_r("Downloading " . $in_scene_id); print_r(" with dataset " . $datasetName); if (file_exists($path_products . $in_scene_id . '.tar.gz')) { echo "\n The file already exists"; } else { $downloadUrl = getDownloadUrl($datasetName, $client, $apiKey, $in_scene_id); //check if downlad is available empty string is not available if (empty($downloadUrl->item)) { //if not available order scenes $downloadUrl = getOrderScene($datasetName, $client, $apiKey, $in_scene_id); //make sure we still got something in case it's just not available for 0 cost. if (empty($downloadUrl->item)) { //nothing available or could not order print_r("\n Could not order products."); } else { //download data once available print_r("\n downloadUrl->item :" . $downloadUrl->item); custom_put_contents($downloadUrl->item, $path_products . $in_scene_id . '.tar.gz'); } } else { //download if not empty - product is available print_r("\n downloadUrl->item :" . $downloadUrl->item); custom_put_contents($downloadUrl->item, $path_products . $in_scene_id . '.tar.gz'); } //print_r("\n downloadUrl->item :".$downloadUrl->item);