1

我需要从 HTTPS URL 下载图像。我知道我们可以使用 cURL 从远程 HTTP url 下载图像,但 HTTPS 协议失败,它返回空白图像。

有什么特别的技巧可以做到这一点吗?我必须从 amazon.com 下载图像的网站

4

1 回答 1

1

curl将适用于 HTTPS。从手册页:

   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.

您可能会遇到证书验证问题。您可以告诉curl忽略这些,请参阅-k选项:

   -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
于 2013-11-07T00:16:13.063 回答