src/fwidm/dwdHourlyCrawler/DWDUtil.php
static function getDataFromZip($zipFile, $extractionPrefix)
    {
        $zip = new ZipArchive;
        self::log(self::class, "zip=" . $zipFile);
        if ($zip->open($zipFile)) {
            for ($i = 0; $i < $zip->numFiles; $i++) {
                $stat = $zip->statIndex($i);
//            print_r(basename($stat['name']) . '<br>');
                //check if the file starts with the prefix
                if (substr($stat['name'], 0, strlen($extractionPrefix)) === $extractionPrefix) {
                    //echo $zip->getFromName($stat['name']);
                    return $zip->getFromName($stat['name']);
                }
            }
            $zip->close();

        } else {
            throw new DWDLibException("zip content is empty! zip file count=" . $zip->numFiles);

        }
        return null;
    }
static function getDataFromZip($zipFile, $extractionPrefix)
    {
        $zip = new ZipArchive;
        self::log(self::class, "zip=" . $zipFile);
        if ($zip->open($zipFile)) {
            for ($i = 0; $i < $zip->numFiles; $i++) {
                $stat = $zip->statIndex($i);
//            print_r(basename($stat['name']) . '<br>');
                //check if the file starts with the prefix
                if (substr($stat['name'], 0, strlen($extractionPrefix)) === $extractionPrefix) {
                    //echo $zip->getFromName($stat['name']);
                    return $zip->getFromName($stat['name']);
                }
            }
            $zip->close();

        } else {
            throw new DWDLibException("zip content is empty! zip file count=" . $zip->numFiles);

        }
        return null;
    }
static function getDataFromZip ( $ zipFile , $ extractionPrefix ) { $ zip = new ZipArchive ; self :: log ( self :: class , "zip=" . $ zipFile ) ; if ( $ zip -> open ( $ zipFile ) ) { for ( $ i = 0 ; $ i < $ zip -> numFiles ; $ i ++ ) { $ stat = $ zip -> statIndex ( $ i ) ; //            print_r(basename($stat['name']) . '<br>'); //check if the file starts with the prefix if ( substr ( $ stat [ 'name' ] , 0 , strlen ( $ extractionPrefix ) ) === $ extractionPrefix ) { //echo $zip->getFromName($stat['name']); return $ zip -> getFromName ( $ stat [ 'name' ] ) ; } } $ zip -> close ( ) ; } else { throw new DWDLibException ( "zip content is empty! zip file count=" . $ zip -> numFiles ) ; } return null ; }
Extract the single file we need to use to get the data.

@param $zipFile - zip file we want to exctract from
@param $extractionPrefix - part of the file's prefix we want to match
@return null|string
Extract the single file we need to use to get the data .