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

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b386f2-2c128.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b386f2-2c128.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?