In php, is it possible to send an image file, obtained through the return of a request by cURL, directly to an S3 bucket using Laravel's methods? If yes, how?
In php, is it possible to send an image file, obtained through the return of a request by cURL, directly to an S3 bucket using Laravel's methods? If yes, how?
I was able to solve the problem without using fopen / fputs, just taking the curl_exec return and using it in the laravel file storage for storage:
private function FileUpload($path, $url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/6.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($curl);
if (curl_error($curl)) {
return false;
}
curl_close($curl);
Storage::disk('s3')->put($path, $content);