Check this. The example uses github api, but should work with normal urls, as long as they return a file. Use file_get_contents to get data from the url
Jan 29, 2022
4
Level 2
Downloading a file from an external source
Is there a way to download a file from a url, but the url doesn't have an extension? So what I mean is, for example I have a file on google drive and I click on the get link option and that link doesn't have an extension it only has this
https://drive.google.com/file/a/random_text/view?usp=sharing
How would I go about saving that to my storage folder? At the moment I only have this in my code
public function getFile($url){
dd(pathinfo($url));
}
and that only gives me
array:3 [
"dirname" => "https://drive.google.com/file/a/random_text/"
"basename" => "view?usp=sharing"
"filename" => "view?usp=sharing"
]
Please or to participate in this conversation.