1

I need to download images from a HTTPS URL. i know we can download images using cURL from a remote HTTP url but it fails for HTTPS Protocol, it return blank image.

Any special trick to do that ? Website i have to download images from is amazon.com

1 Answer 1

1

curl will work fine for HTTPS. From the man page:

   curl  is  a  tool to transfer data from or to a server, using one of the
   supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP,  HTTPS,  IMAP,
   IMAPS,  LDAP,  LDAPS,  POP3,  POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS,
   TELNET and TFTP).  The command is designed to work without user interac-
   tion.

You're likely running into certificate validation issues. You can tell curl to ignore these, see the -k option:

   -k, --insecure
          (SSL)  This  option  explicitly allows curl to perform "insecure"
          SSL connections and transfers. All SSL connections are  attempted
          to be made secure by using the CA certificate bundle installed by
          default. This makes all connections  considered  "insecure"  fail
          unless -k, --insecure is used.

          See     this     online    resource    for    further    details:
          http://curl.haxx.se/docs/sslcerts.html
2
  • curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    – imran
    Nov 7, 2013 at 1:04
  • This line of code resolved my issue. Thanks for the help , again.
    – imran
    Nov 7, 2013 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.