Core/Toolbox/IO/Download.php
/**
     * Fetches an url and writes the returned content to a file
     *
     * @param string $url
     *            URL to request
     * @param string $target
     *            Filepath to store the result
     *            
     * @throws DownloadException
     *
     * @return bool
     */
Fetches an url and writes the returned content to a file
@param string $url
URL to request
@param string $target
Filepath to store the result



@return bool
Fetches an url and writes the returned content to a file @param string $url URL to request @param string $target Filepath to store the result @return bool
public function download(): bool
    {
        if (empty($this->source)) {
            Throw new DownloadException('No source for download set.');
        }
        if (empty($this->target)) {
            Throw new DownloadException('No target for download set.');
        }
        try {
            $data = $this->fetch($this->source);
            if (preg_match('/Found/', $data)) {
                return false;
            }
            file_put_contents($this->target, $data);
            return true;
        }
        catch (\Throwable $t) {
            Throw new DownloadException(sprintf('Download of source "%s" failed with error: $s', $this->source, $t->getMessage()));
            return false;
        }
    }
public function download ( ) : bool { if ( empty ( $ this -> source ) ) { Throw new DownloadException ( 'No source for download set.' ) ; } if ( empty ( $ this -> target ) ) { Throw new DownloadException ( 'No target for download set.' ) ; } try { $ data = $ this -> fetch ( $ this -> source ) ; if ( preg_match ( '/Found/' , $ data ) ) { return false ; } file_put_contents ( $ this -> target , $ data ) ; return true ; } catch ( \ Throwable $ t ) { Throw new DownloadException ( sprintf ( 'Download of source "%s" failed with error: $s' , $ this -> source , $ t -> getMessage ( ) ) ) ; return false ; } }
Fetches an url and writes the returned content to a file
 @param string $url
            URL to request
 @param string $target
            Filepath to store the result
Fetches an url and writes the returned content to a file @param string $url URL to request @param string $target Filepath to store the result