PHP download file from url using curl exampleBy Hardik Savani | March 21, 2016 | | 6698 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+");
- AngularJS - scroll to a specific element using anchorscroll
- Laravel - How to remove foreign key constraint using migration?
- How to implement Email Verification with Activation Code example from Scratch in Laravel 5.2 ?
- How to count number of files in directory PHP?
- PHP Laravel 5 - Sub-domain routing file Example
- Codeigniter 3 - select2 ajax autocomplete from database example with demo
- Twitter typeahead press enter key go to search page.
- PHP - Getting Started PHPUnit test with simple example