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'); //print_r("\n downloadUrl->item :".$downloadUrl->item); //custom_put_contents($downloadUrl->item,$path_products.$row[0].'.tar.gz'); } print_r("\n"); } } pg_close($lsf_conn); // add back original umask file_put_contents('downloaded.txt', print_r($downloaded_array, true)); umask($oldUMASK); } catch (Exception $e) { die("Error: {$e->getMessage()}\n\n"); }
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); //custom_put_contents($downloadUrl->item,$path_products.$in_scene_id.'.tar.gz'); } print_r("\n"); //pg_close($lsf_conn); // add back original umask umask($oldUMASK); } catch (Exception $e) { die("Error: {$e->getMessage()}\n\n"); }