PHP download file from url using curl exampleBy Hardik Savani | March 21, 2016 | | 16085 Viewer | Category : PHP CURL
Whenever you require to download file or image from URL using php curl. then you can see that example. we can download image or file from given url and save in over local server. you can do that using get_file_contents() in php too, but i think it is good if you are doing that using PHP curl. let's see following example :
$url = 'http://www.test.com/1458398816_33370444.jpg';
$curlCh = curl_init();
curl_setopt($curlCh, CURLOPT_URL, $url);
curl_setopt($curlCh, CURLOPT_RETURNTRANSFER, 1);
$curlData = curl_exec ($curlCh);
$downloadPath = "upload/flower10.jpg";
$file = fopen($downloadPath, "w+");
- How to get Ip Address in Codeigniter?
- How to solve - This cache store does not support tagging?
- Laravel 5 - "syntax error or access violation 1055 in group by" Solved
- How to add multiple markers in google map
- Laravel 5 Stripe example using Laravel Cashier from Scratch
- Laravel 5.5 - Validation Data Return - New Feature
- How to add git add remote origin on bitbucket repository ?
- Laravel 5 dynamic autocomplete search using select2 JS Ajax - Part 1