src/Support/Download/UrlDownloader.php
public function download($url)
    {
        $localPath = $this->makeLocalTemporaryPath();

        $url = $this->normalizeUrl($url);

        $this->downloadToTempLocalPath($url, $localPath);

        // Remove the query string if it exists, to make sure the extension is valid
        if (false !== strpos($url, '?')) {
            $url = explode('?', $url)[0];
        }

        $pathinfo = pathinfo($url);

        // If the file has no extension, rename the local instance with a guessed extension added.
        if (empty($pathinfo['extension'])) {
            $localPath = $this->renameLocalTemporaryFileWithAddedExtension($localPath, $pathinfo['basename']);
        }

        return $localPath;
    }
public function download($url)
    {
        $localPath = $this->makeLocalTemporaryPath();

        $url = $this->normalizeUrl($url);

        $this->downloadToTempLocalPath($url, $localPath);

        // Remove the query string if it exists, to make sure the extension is valid
        if (false !== strpos($url, '?')) {
            $url = explode('?', $url)[0];
        }

        $pathinfo = pathinfo($url);

        // If the file has no extension, rename the local instance with a guessed extension added.
        if (empty($pathinfo['extension'])) {
            $localPath = $this->renameLocalTemporaryFileWithAddedExtension($localPath, $pathinfo['basename']);
        }

        return $localPath;
    }
public function download ( $ url ) { $ localPath = $ this -> makeLocalTemporaryPath ( ) ; $ url = $ this -> normalizeUrl ( $ url ) ; $ this -> downloadToTempLocalPath ( $ url , $ localPath ) ; // Remove the query string if it exists, to make sure the extension is valid if ( false !== strpos ( $ url , '?' ) ) { $ url = explode ( '?' , $ url ) [ 0 ] ; } $ pathinfo = pathinfo ( $ url ) ; // If the file has no extension, rename the local instance with a guessed extension added. if ( empty ( $ pathinfo [ 'extension' ] ) ) { $ localPath = $ this -> renameLocalTemporaryFileWithAddedExtension ( $ localPath , $ pathinfo [ 'basename' ] ) ; } return $ localPath ; }
Downloads from a URL and returns locally stored temporary file.

@param string $url
@return string
@throws CouldNotRetrieveRemoteFileException
Downloads from a URL and returns locally stored temporary file .