PHP downloads remote files with no file suffix

excuse me: the business needs to download the remote file returned by the third-party interface, but the third-party file url does not have a file suffix. What should I do with its suffix after this download?

Php
Mar.17,2021

get the contents of the file and put it in a new file with a suffix
file_put_contents (file_get_contents (url), "newfile");


I think we should first agree on the file type returned and determine the suffix of the file after download, otherwise it may cause improper preservation of music and other non-text files

.
Menu