Skip to content
Advertisement

Corrupted image on auto download using url with curl in php

I want to download images from my server without clicking anything – when my php file executes it will download automatically, but the problem is the file is corrupt. However, when I paste the url directly in the browser and download, it works perfectly. So why does my implementation below not work? Any ideas about this?

Here’s my code:

JavaScript

Advertisement

Answer

Hi everyone thanks to your help, but I solved my own problem instead of curl I used this very simple code.

$image_url = ‘http://server***.com/axul-display/assets/ads/ads-id-4.gif’;

JavaScript

Big thanks everyone!

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement