PHP download file from url using curl exampleBy Hardik Savani | March 21, 2016 | | 2614 Viewer | Category : PHP CURL
Share this post:
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 send mail example in Laravel 5?
- How to upgrade node.js version in Ubuntu?
- How to get soft deleted records in Laravel 5?
- Mailgun setup with Laravel 5 example
- How to add CKEditor with image upload using KCFinder in PHP Example Code?
- Laravel 5.2 chat message module using socket.io, redis, express and nodejs from from scratch.
- Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo
- Codeigniter Angularjs http post not working