private function downloadFile($countryCode)
    {
        $tempname = sys_get_temp_dir() . '/elcodi-locator-geonames-' . $countryCode . '.zip';
        if (!file_exists($tempname)) {
            $dirname = dirname($tempname);
            if (!file_exists($dirname)) {
                mkdir($dirname, 0777, true);
            }
            $downloadUrl = 'http://download.geonames.org/export/zip/' . $countryCode . '.zip';
            copy($downloadUrl, $tempname);
        }

        return $tempname;
    }
private function downloadFile($countryCode)
    {
        $tempname = sys_get_temp_dir() . '/elcodi-locator-geonames-' . $countryCode . '.zip';
        if (!file_exists($tempname)) {
            $dirname = dirname($tempname);
            if (!file_exists($dirname)) {
                mkdir($dirname, 0777, true);
            }
            $downloadUrl = 'http://download.geonames.org/export/zip/' . $countryCode . '.zip';
            copy($downloadUrl, $tempname);
        }

        return $tempname;
    }
private function downloadFile ( $ countryCode ) { $ tempname = sys_get_temp_dir ( ) . '/elcodi-locator-geonames-' . $ countryCode . '.zip' ; if ( ! file_exists ( $ tempname ) ) { $ dirname = dirname ( $ tempname ) ; if ( ! file_exists ( $ dirname ) ) { mkdir ( $ dirname , 0777 , true ) ; } $ downloadUrl = 'http://download.geonames.org/export/zip/' . $ countryCode . '.zip' ; copy ( $ downloadUrl , $ tempname ) ; } return $ tempname ; }
Download data file from country
Avoids download if the file exists.

@param string $countryCode Country code

@return string
Download data file from country Avoids download if the file exists .